Diff
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor
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
+ 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
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/CMakeLists.txt (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/CMakeLists.txt 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/CMakeLists.txt 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1,6 +1,8 @@
# FREESWITCH CMAKE BUILD
# Created by SHANE BURRELL 2009 (supjigator)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
PROJECT (freeswitch)
#GETSVN VERSION
@@ -29,8 +31,6 @@
INCLUDE (CheckTypeSize)
INCLUDE (CheckCXXSourceCompiles)
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-
MESSAGE( STATUS )
MESSAGE( STATUS "FREESWITCH CMAKE Build-----------------------------------------" )
MESSAGE( STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" )
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/Freeswitch.2005.unsupported.sln (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/Freeswitch.2005.unsupported.sln 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/Freeswitch.2005.unsupported.sln 2009-11-02 10:10:22 UTC (rev 15314)
@@ -184,6 +184,9 @@
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Libraries", "_Libraries", "{EB910B0D-F27D-4B62-B67B-DE834C99AC5B}"
+ ProjectSection(SolutionItems) = preProject
+ libs\spandsp\src\msvc\make_modem_filter.2005.vcproj = libs\spandsp\src\msvc\make_modem_filter.2005.vcproj
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdingaling", "libs\libdingaling\libdingaling.vcproj", "{1906D736-08BD-4EE1-924F-B536249B9A54}"
ProjectSection(ProjectDependencies) = postProject
@@ -762,12 +765,11 @@
{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvoipcodecs", "libs\voipcodecs\libvoipcodecs.vcproj", "{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_voipcodecs", "src\mod\codecs\mod_voipcodecs\mod_voipcodecs.vcproj", "{9EED03C8-8315-4214-8D13-8FF5FA46D93C}"
ProjectSection(ProjectDependencies) = postProject
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {CF70F278-3364-4395-A2E1-23501C9B8AD2} = {CF70F278-3364-4395-A2E1-23501C9B8AD2}
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}"
@@ -812,544 +814,854 @@
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libs\spandsp\src\libtiff.2005.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libs\spandsp\src\libspandsp.2005.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
+ ProjectSection(ProjectDependencies) = postProject
+ {329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838}
+ {DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330}
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_at_dictionary", "libs\spandsp\src\msvc\make_at_dictionary.2005.vcproj", "{DEE932AB-5911-4700-9EEB-8C7090A0A330}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_modem_filter", "libs\spandsp\src\msvc\make_modem_filter.2005.vcproj", "{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ All|Win32 = All|Win32
+ All|x64 = All|x64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|Win32.ActiveCfg = Release|Win32
+ {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|Win32.Build.0 = Release|Win32
+ {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x64.ActiveCfg = Release|Win32
{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|Win32.ActiveCfg = Debug|Win32
{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|Win32.Build.0 = Debug|Win32
{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x64.ActiveCfg = Debug|Win32
{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|Win32.ActiveCfg = Release|Win32
{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|Win32.Build.0 = Release|Win32
{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x64.ActiveCfg = Release|Win32
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|Win32.ActiveCfg = Release|Win32
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|Win32.Build.0 = Release|Win32
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x64.ActiveCfg = Release|Win32
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|Win32.ActiveCfg = Debug|Win32
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|Win32.Build.0 = Debug|Win32
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x64.ActiveCfg = Debug|Win32
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|Win32.ActiveCfg = Release|Win32
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|Win32.Build.0 = Release|Win32
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x64.ActiveCfg = Release|Win32
+ {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|Win32.ActiveCfg = Release Passthrough|Win32
+ {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|Win32.Build.0 = Release Passthrough|Win32
+ {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x64.ActiveCfg = Release Passthrough|Win32
{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32
{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|Win32.Build.0 = Debug Passthrough|Win32
{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x64.ActiveCfg = Debug|Win32
{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|Win32.ActiveCfg = Release Passthrough|Win32
{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|Win32.Build.0 = Release Passthrough|Win32
{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x64.ActiveCfg = Release|Win32
+ {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|Win32.ActiveCfg = Release|Win32
+ {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|Win32.Build.0 = Release|Win32
+ {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x64.ActiveCfg = Release|Win32
{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|Win32.ActiveCfg = Debug|Win32
{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|Win32.Build.0 = Debug|Win32
{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x64.ActiveCfg = Debug|Win32
{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
{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|Win32.ActiveCfg = Debug|Win32
{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|Win32.Build.0 = Debug|Win32
{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x64.ActiveCfg = Debug|Win32
{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|Win32.ActiveCfg = Release|Win32
{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|Win32.Build.0 = Release|Win32
{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x64.ActiveCfg = Release|Win32
+ {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|Win32.ActiveCfg = Release|Win32
+ {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|Win32.Build.0 = Release|Win32
+ {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x64.ActiveCfg = Release|Win32
{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|Win32.ActiveCfg = Debug|Win32
{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|Win32.Build.0 = Debug|Win32
{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x64.ActiveCfg = Debug|Win32
{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.ActiveCfg = Release|Win32
{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.Build.0 = Release|Win32
{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x64.ActiveCfg = Release|Win32
+ {1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|Win32.ActiveCfg = Release|Win32
+ {1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|Win32.Build.0 = Release|Win32
+ {1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|x64.ActiveCfg = Release|Win32
{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|Win32.ActiveCfg = Debug|Win32
{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|x64.ActiveCfg = Debug|Win32
{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|Win32.ActiveCfg = Release|Win32
{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|x64.ActiveCfg = Release|Win32
+ {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|Win32.ActiveCfg = Release|Win32
+ {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|Win32.Build.0 = Release|Win32
+ {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x64.ActiveCfg = Release|Win32
{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|Win32.ActiveCfg = Debug|Win32
{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|Win32.Build.0 = Debug|Win32
{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x64.ActiveCfg = Debug|Win32
{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|Win32.ActiveCfg = Release|Win32
{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|Win32.Build.0 = Release|Win32
{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x64.ActiveCfg = Release|Win32
+ {B17FFBE6-A942-4056-8346-B624FB5D995B}.All|Win32.ActiveCfg = Release with MySql
+ {B17FFBE6-A942-4056-8346-B624FB5D995B}.All|Win32.Build.0 = Release with MySql
+ {B17FFBE6-A942-4056-8346-B624FB5D995B}.All|x64.ActiveCfg = Release with MySql
+ {B17FFBE6-A942-4056-8346-B624FB5D995B}.All|x64.Build.0 = Release with MySql
{B17FFBE6-A942-4056-8346-B624FB5D995B}.Debug|Win32.ActiveCfg = Debug
{B17FFBE6-A942-4056-8346-B624FB5D995B}.Debug|x64.ActiveCfg = Debug with MySql
{B17FFBE6-A942-4056-8346-B624FB5D995B}.Debug|x64.Build.0 = Debug with MySql
{B17FFBE6-A942-4056-8346-B624FB5D995B}.Release|Win32.ActiveCfg = Release
{B17FFBE6-A942-4056-8346-B624FB5D995B}.Release|x64.ActiveCfg = Release with MySql
{B17FFBE6-A942-4056-8346-B624FB5D995B}.Release|x64.Build.0 = Release with MySql
+ {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|Win32.ActiveCfg = Release MS-LDAP|Win32
+ {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|Win32.Build.0 = Release MS-LDAP|Win32
+ {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x64.ActiveCfg = Release MS-LDAP|Win32
{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|Win32.ActiveCfg = Debug MS-LDAP|Win32
{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|Win32.Build.0 = Debug MS-LDAP|Win32
{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x64.ActiveCfg = Debug|Win32
{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|Win32.ActiveCfg = Release MS-LDAP|Win32
{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|Win32.Build.0 = Release MS-LDAP|Win32
{EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x64.ActiveCfg = Release|Win32
+ {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|Win32.ActiveCfg = Release|Win32
+ {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|Win32.Build.0 = Release|Win32
+ {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x64.ActiveCfg = Release|Win32
{A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|Win32.ActiveCfg = Debug|Win32
{A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|Win32.Build.0 = Debug|Win32
{A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x64.ActiveCfg = Debug|Win32
{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|Win32.ActiveCfg = Release|Win32
{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|Win32.Build.0 = Release|Win32
{A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x64.ActiveCfg = Release|Win32
+ {C7705DC4-2088-493E-AF8D-65BC6D65C125}.All|Win32.ActiveCfg = Release|Win32
+ {C7705DC4-2088-493E-AF8D-65BC6D65C125}.All|Win32.Build.0 = Release|Win32
+ {C7705DC4-2088-493E-AF8D-65BC6D65C125}.All|x64.ActiveCfg = Release|Win32
{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Debug|Win32.ActiveCfg = Debug|Win32
{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Debug|Win32.Build.0 = Debug|Win32
{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Debug|x64.ActiveCfg = Debug|Win32
{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|Win32.ActiveCfg = Release|Win32
{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|Win32.Build.0 = Release|Win32
{C7705DC4-2088-493E-AF8D-65BC6D65C125}.Release|x64.ActiveCfg = Release|Win32
+ {784113EF-44D9-4949-835D-7065D3C7AD08}.All|Win32.ActiveCfg = Release|Win32
+ {784113EF-44D9-4949-835D-7065D3C7AD08}.All|Win32.Build.0 = Release|Win32
+ {784113EF-44D9-4949-835D-7065D3C7AD08}.All|x64.ActiveCfg = Release|Win32
{784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|Win32.ActiveCfg = Debug|Win32
{784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|Win32.Build.0 = Debug|Win32
{784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x64.ActiveCfg = Debug|Win32
{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|Win32.ActiveCfg = Release|Win32
{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|Win32.Build.0 = Release|Win32
{784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x64.ActiveCfg = Release|Win32
+ {89385C74-5860-4174-9CAF-A39E7C48909C}.All|Win32.ActiveCfg = Release|Win32
+ {89385C74-5860-4174-9CAF-A39E7C48909C}.All|Win32.Build.0 = Release|Win32
+ {89385C74-5860-4174-9CAF-A39E7C48909C}.All|x64.ActiveCfg = Release|Win32
{89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|Win32.ActiveCfg = Debug|Win32
{89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|Win32.Build.0 = Debug|Win32
{89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x64.ActiveCfg = Debug|Win32
{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.ActiveCfg = Release|Win32
{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.Build.0 = Release|Win32
{89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.ActiveCfg = Release|Win32
+ {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|Win32
+ {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.Build.0 = Release|Win32
+ {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|Win32
{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.ActiveCfg = Debug|Win32
{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.Build.0 = Debug|Win32
{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|Win32
{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.ActiveCfg = Release|Win32
{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.Build.0 = Release|Win32
{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|Win32
+ {692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.ActiveCfg = Release|Win32
+ {692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.Build.0 = Release|Win32
+ {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.ActiveCfg = Release|Win32
{692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|Win32.ActiveCfg = Debug|Win32
{692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|x64.ActiveCfg = Debug|Win32
{692F6330-4D87-4C82-81DF-40DB5892636E}.Release|Win32.ActiveCfg = Release|Win32
{692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64.ActiveCfg = Release|Win32
+ {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|Win32.ActiveCfg = Release|Win32
+ {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|Win32.Build.0 = Release|Win32
+ {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.ActiveCfg = Release|Win32
{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|Win32.ActiveCfg = Debug|Win32
{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|Win32.Build.0 = Debug|Win32
{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x64.ActiveCfg = Debug|Win32
{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|Win32.ActiveCfg = Release|Win32
{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|Win32.Build.0 = Release|Win32
{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.ActiveCfg = Release|Win32
+ {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|Win32.ActiveCfg = Release|Win32
+ {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|Win32.Build.0 = Release|Win32
+ {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64.ActiveCfg = Release|Win32
{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|Win32.ActiveCfg = Debug|Win32
{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|Win32.Build.0 = Debug|Win32
{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64.ActiveCfg = Debug|Win32
{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|Win32.ActiveCfg = Release|Win32
{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|Win32.Build.0 = Release|Win32
{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.ActiveCfg = Release|Win32
+ {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|Win32.ActiveCfg = Release|Win32
+ {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|Win32.Build.0 = Release|Win32
+ {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64.ActiveCfg = Release|Win32
{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|Win32.ActiveCfg = Debug|Win32
{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|Win32.Build.0 = Debug|Win32
{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x64.ActiveCfg = Debug|Win32
{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|Win32.ActiveCfg = Release|Win32
{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|Win32.Build.0 = Release|Win32
{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x64.ActiveCfg = Release|Win32
+ {1C453396-D912-4213-89FD-9B489162B7B5}.All|Win32.ActiveCfg = Release|Win32
+ {1C453396-D912-4213-89FD-9B489162B7B5}.All|Win32.Build.0 = Release|Win32
+ {1C453396-D912-4213-89FD-9B489162B7B5}.All|x64.ActiveCfg = Release|Win32
{1C453396-D912-4213-89FD-9B489162B7B5}.Debug|Win32.ActiveCfg = Debug|Win32
{1C453396-D912-4213-89FD-9B489162B7B5}.Debug|Win32.Build.0 = Debug|Win32
{1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x64.ActiveCfg = Debug|Win32
{1C453396-D912-4213-89FD-9B489162B7B5}.Release|Win32.ActiveCfg = Release|Win32
{1C453396-D912-4213-89FD-9B489162B7B5}.Release|Win32.Build.0 = Release|Win32
{1C453396-D912-4213-89FD-9B489162B7B5}.Release|x64.ActiveCfg = Release|Win32
+ {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|Win32.ActiveCfg = Release|Win32
+ {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|Win32.Build.0 = Release|Win32
+ {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x64.ActiveCfg = Release|Win32
{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|Win32.ActiveCfg = Debug|Win32
{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|Win32.Build.0 = Debug|Win32
{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x64.ActiveCfg = Debug|Win32
{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|Win32.ActiveCfg = Release|Win32
{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|Win32.Build.0 = Release|Win32
{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.ActiveCfg = Release|Win32
+ {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|Win32.ActiveCfg = Release|Win32
+ {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|Win32.Build.0 = Release|Win32
+ {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64.ActiveCfg = Release|Win32
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.ActiveCfg = Debug|Win32
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.Build.0 = Debug|Win32
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64.ActiveCfg = Debug|Win32
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.ActiveCfg = Release|Win32
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.Build.0 = Release|Win32
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.ActiveCfg = Release|Win32
+ {C24FB505-05D7-4319-8485-7540B44C8603}.All|Win32.ActiveCfg = Release|Win32
+ {C24FB505-05D7-4319-8485-7540B44C8603}.All|Win32.Build.0 = Release|Win32
+ {C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.ActiveCfg = Release|Win32
{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|Win32.ActiveCfg = Debug|Win32
{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|Win32.Build.0 = Debug|Win32
{C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x64.ActiveCfg = Debug|Win32
{C24FB505-05D7-4319-8485-7540B44C8603}.Release|Win32.ActiveCfg = Release|Win32
{C24FB505-05D7-4319-8485-7540B44C8603}.Release|Win32.Build.0 = Release|Win32
{C24FB505-05D7-4319-8485-7540B44C8603}.Release|x64.ActiveCfg = Release|Win32
+ {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|Win32.ActiveCfg = Release|Win32
+ {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|Win32.Build.0 = Release|Win32
+ {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x64.ActiveCfg = Release|Win32
{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|Win32.ActiveCfg = Debug|Win32
{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|Win32.Build.0 = Debug|Win32
{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x64.ActiveCfg = Debug|Win32
{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|Win32.ActiveCfg = Release|Win32
{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|Win32.Build.0 = Release|Win32
{B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x64.ActiveCfg = Release|Win32
+ {05515420-16DE-4E63-BE73-85BE85BA5142}.All|Win32.ActiveCfg = Release|Win32
+ {05515420-16DE-4E63-BE73-85BE85BA5142}.All|Win32.Build.0 = Release|Win32
+ {05515420-16DE-4E63-BE73-85BE85BA5142}.All|x64.ActiveCfg = Release|Win32
{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|Win32.ActiveCfg = Debug|Win32
{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|Win32.Build.0 = Debug|Win32
{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x64.ActiveCfg = Debug|Win32
{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.ActiveCfg = Release|Win32
{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.Build.0 = Release|Win32
{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.ActiveCfg = Release|Win32
+ {1906D736-08BD-4EE1-924F-B536249B9A54}.All|Win32.ActiveCfg = Release DLL|Win32
+ {1906D736-08BD-4EE1-924F-B536249B9A54}.All|Win32.Build.0 = Release DLL|Win32
+ {1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64.ActiveCfg = Release DLL|Win32
{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.ActiveCfg = Debug|Win32
{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.Build.0 = Debug|Win32
{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.ActiveCfg = Debug|Win32
{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|Win32.ActiveCfg = Release|Win32
{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|Win32.Build.0 = Release|Win32
{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.ActiveCfg = Release|Win32
+ {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|Win32.ActiveCfg = Release Dll|Win32
+ {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|Win32.Build.0 = Release Dll|Win32
+ {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64.ActiveCfg = Release Dll|Win32
{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|Win32.ActiveCfg = Debug|Win32
{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|Win32.Build.0 = Debug|Win32
{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x64.ActiveCfg = Debug|Win32
{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|Win32.ActiveCfg = Release|Win32
{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|Win32.Build.0 = Release|Win32
{EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64.ActiveCfg = Release|Win32
+ {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|Win32.ActiveCfg = Release DLL|Win32
+ {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|Win32.Build.0 = Release DLL|Win32
+ {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x64.ActiveCfg = Release DLL|Win32
{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.ActiveCfg = Debug|Win32
{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.Build.0 = Debug|Win32
{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64.ActiveCfg = Debug|Win32
{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.ActiveCfg = Release|Win32
{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.Build.0 = Release|Win32
{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64.ActiveCfg = Release|Win32
+ {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|Win32.ActiveCfg = Release DLL|Win32
+ {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|Win32.Build.0 = Release DLL|Win32
+ {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x64.ActiveCfg = Release DLL|Win32
{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.ActiveCfg = Debug|Win32
{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.Build.0 = Debug|Win32
{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x64.ActiveCfg = Debug|Win32
{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.ActiveCfg = Release|Win32
{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.Build.0 = Release|Win32
{8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64.ActiveCfg = Release|Win32
+ {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|Win32.ActiveCfg = Release|Win32
+ {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|Win32.Build.0 = Release|Win32
+ {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64.ActiveCfg = Release|Win32
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.ActiveCfg = Debug|Win32
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.Build.0 = Debug|Win32
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64.ActiveCfg = Debug|Win32
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.ActiveCfg = Release|Win32
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.Build.0 = Release|Win32
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.ActiveCfg = Release|Win32
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|Win32.ActiveCfg = Release|Win32
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|Win32.Build.0 = Release|Win32
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x64.ActiveCfg = Release|Win32
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|Win32.ActiveCfg = Debug|Win32
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|Win32.Build.0 = Debug|Win32
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x64.ActiveCfg = Debug|Win32
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|Win32.ActiveCfg = Release|Win32
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|Win32.Build.0 = Release|Win32
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.ActiveCfg = Release|Win32
+ {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|Win32.ActiveCfg = Release|Win32
+ {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|Win32.Build.0 = Release|Win32
+ {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64.ActiveCfg = Release|Win32
{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.ActiveCfg = Debug|Win32
{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.Build.0 = Debug|Win32
{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64.ActiveCfg = Debug|Win32
{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.ActiveCfg = Release|Win32
{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.Build.0 = Release|Win32
{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.ActiveCfg = Release|Win32
+ {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|Win32.ActiveCfg = Release|Win32
+ {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|Win32.Build.0 = Release|Win32
+ {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64.ActiveCfg = Release|Win32
{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|Win32.ActiveCfg = Debug|Win32
{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|Win32.Build.0 = Debug|Win32
{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x64.ActiveCfg = Debug|Win32
{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|Win32.ActiveCfg = Release|Win32
{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|Win32.Build.0 = Release|Win32
{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.ActiveCfg = Release|Win32
+ {5927104D-C14C-4AC8-925C-4AB681762E75}.All|Win32.ActiveCfg = Release|Win32
+ {5927104D-C14C-4AC8-925C-4AB681762E75}.All|Win32.Build.0 = Release|Win32
+ {5927104D-C14C-4AC8-925C-4AB681762E75}.All|x64.ActiveCfg = Release|Win32
{5927104D-C14C-4AC8-925C-4AB681762E75}.Debug|Win32.ActiveCfg = Debug|Win32
{5927104D-C14C-4AC8-925C-4AB681762E75}.Debug|Win32.Build.0 = Debug|Win32
{5927104D-C14C-4AC8-925C-4AB681762E75}.Debug|x64.ActiveCfg = Debug|Win32
{5927104D-C14C-4AC8-925C-4AB681762E75}.Release|Win32.ActiveCfg = Release|Win32
{5927104D-C14C-4AC8-925C-4AB681762E75}.Release|Win32.Build.0 = Release|Win32
{5927104D-C14C-4AC8-925C-4AB681762E75}.Release|x64.ActiveCfg = Release|Win32
+ {0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.All|Win32.ActiveCfg = Release|Win32
+ {0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.All|Win32.Build.0 = Release|Win32
+ {0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.All|x64.ActiveCfg = Release|Win32
{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Debug|Win32.ActiveCfg = Debug|Win32
{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Debug|Win32.Build.0 = Debug|Win32
{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Debug|x64.ActiveCfg = Debug|Win32
{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|Win32.ActiveCfg = Release|Win32
{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|Win32.Build.0 = Release|Win32
{0D826AF5-0506-4C50-BB8B-7DB019AC21AE}.Release|x64.ActiveCfg = Release|Win32
+ {49C34584-B6DA-448F-83CF-27584DC9FC90}.All|Win32.ActiveCfg = Release|Win32
+ {49C34584-B6DA-448F-83CF-27584DC9FC90}.All|Win32.Build.0 = Release|Win32
+ {49C34584-B6DA-448F-83CF-27584DC9FC90}.All|x64.ActiveCfg = Release|Win32
{49C34584-B6DA-448F-83CF-27584DC9FC90}.Debug|Win32.ActiveCfg = Debug|Win32
{49C34584-B6DA-448F-83CF-27584DC9FC90}.Debug|Win32.Build.0 = Debug|Win32
{49C34584-B6DA-448F-83CF-27584DC9FC90}.Debug|x64.ActiveCfg = Debug|Win32
{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|Win32.ActiveCfg = Release|Win32
{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|Win32.Build.0 = Release|Win32
{49C34584-B6DA-448F-83CF-27584DC9FC90}.Release|x64.ActiveCfg = Release|Win32
+ {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|Win32.ActiveCfg = Release|Win32
+ {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|Win32.Build.0 = Release|Win32
+ {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x64.ActiveCfg = Release|Win32
{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|Win32.ActiveCfg = Debug|Win32
{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|Win32.Build.0 = Debug|Win32
{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x64.ActiveCfg = Debug|Win32
{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|Win32.ActiveCfg = Release|Win32
{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|Win32.Build.0 = Release|Win32
{3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x64.ActiveCfg = Release|Win32
+ {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|Win32.ActiveCfg = Debug|Win32
+ {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|Win32.Build.0 = Debug|Win32
+ {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x64.ActiveCfg = Debug|Win32
{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|Win32.ActiveCfg = Debug|Win32
{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|Win32.Build.0 = Debug|Win32
{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x64.ActiveCfg = Debug|Win32
{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.ActiveCfg = Release|Win32
{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.Build.0 = Release|Win32
{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.ActiveCfg = Release|Win32
+ {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|Win32.ActiveCfg = Debug|Win32
+ {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|Win32.Build.0 = Debug|Win32
+ {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64.ActiveCfg = Debug|Win32
{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.ActiveCfg = Debug|Win32
{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.Build.0 = Debug|Win32
{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.ActiveCfg = Debug|Win32
{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|Win32.ActiveCfg = Release|Win32
{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|Win32.Build.0 = Release|Win32
{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.ActiveCfg = Release|Win32
+ {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|Win32.ActiveCfg = Debug|Win32
+ {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|Win32.Build.0 = Debug|Win32
+ {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x64.ActiveCfg = Debug|Win32
{204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|Win32.ActiveCfg = Debug|Win32
{204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|Win32.Build.0 = Debug|Win32
{204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x64.ActiveCfg = Debug|Win32
{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|Win32.ActiveCfg = Release|Win32
{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|Win32.Build.0 = Release|Win32
{204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x64.ActiveCfg = Release|Win32
+ {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|Win32.ActiveCfg = Release|Win32
+ {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|Win32.Build.0 = Release|Win32
+ {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64.ActiveCfg = Release|Win32
{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|Win32.ActiveCfg = Debug|Win32
{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|Win32.Build.0 = Debug|Win32
{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x64.ActiveCfg = Debug|Win32
{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|Win32.ActiveCfg = Release|Win32
{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|Win32.Build.0 = Release|Win32
{0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.ActiveCfg = Release|Win32
+ {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|Win32.ActiveCfg = Release|Win32
+ {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|Win32.Build.0 = Release|Win32
+ {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.ActiveCfg = Release|Win32
{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.ActiveCfg = Debug|Win32
{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.Build.0 = Debug|Win32
{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.ActiveCfg = Debug|Win32
{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.ActiveCfg = Release|Win32
{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.Build.0 = Release|Win32
{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.ActiveCfg = Release|Win32
+ {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|Win32.ActiveCfg = Release|Win32
+ {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|Win32.Build.0 = Release|Win32
+ {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x64.ActiveCfg = Release|Win32
{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|Win32.ActiveCfg = Debug|Win32
{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|Win32.Build.0 = Debug|Win32
{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x64.ActiveCfg = Debug|Win32
{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|Win32.ActiveCfg = Release|Win32
{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|Win32.Build.0 = Release|Win32
{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x64.ActiveCfg = Release|Win32
+ {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|Win32.ActiveCfg = Release DLL|Win32
+ {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|Win32.Build.0 = Release DLL|Win32
+ {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x64.ActiveCfg = Release DLL|Win32
{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|Win32.ActiveCfg = Debug DLL|Win32
{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|Win32.Build.0 = Debug DLL|Win32
{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x64.ActiveCfg = Debug DLL|Win32
{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|Win32.ActiveCfg = Release DLL|Win32
{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|Win32.Build.0 = Release DLL|Win32
{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x64.ActiveCfg = Release|Win32
+ {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|Win32.ActiveCfg = Release Passthrough|Win32
+ {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|Win32.Build.0 = Release Passthrough|Win32
+ {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x64.ActiveCfg = Release Passthrough|Win32
{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32
{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|Win32.Build.0 = Debug Passthrough|Win32
{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x64.ActiveCfg = Debug|Win32
{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|Win32.ActiveCfg = Release Passthrough|Win32
{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|Win32.Build.0 = Release Passthrough|Win32
{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.ActiveCfg = Release|Win32
+ {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|Win32.ActiveCfg = Release|Win32
+ {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|Win32.Build.0 = Release|Win32
+ {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.ActiveCfg = Release|Win32
{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|Win32.ActiveCfg = Debug|Win32
{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|Win32.Build.0 = Debug|Win32
{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x64.ActiveCfg = Debug|Win32
{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|Win32.ActiveCfg = Release|Win32
{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|Win32.Build.0 = Release|Win32
{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x64.ActiveCfg = Release|Win32
+ {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|Win32.ActiveCfg = Release|Win32
+ {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|Win32.Build.0 = Release|Win32
+ {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x64.ActiveCfg = Release|Win32
{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.ActiveCfg = Debug|Win32
{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.Build.0 = Debug|Win32
{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64.ActiveCfg = Debug|Win32
{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.ActiveCfg = Release|Win32
{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.Build.0 = Release|Win32
{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.ActiveCfg = Release|Win32
+ {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|Win32.ActiveCfg = Release|Win32
+ {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|Win32.Build.0 = Release|Win32
+ {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64.ActiveCfg = Release|Win32
{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.ActiveCfg = Debug|Win32
{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.Build.0 = Debug|Win32
{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64.ActiveCfg = Debug|Win32
{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.ActiveCfg = Release|Win32
{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.Build.0 = Release|Win32
{8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.ActiveCfg = Release|Win32
+ {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|Win32.ActiveCfg = Release|Win32
+ {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|Win32.Build.0 = Release|Win32
+ {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.ActiveCfg = Release|Win32
{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.ActiveCfg = Debug|Win32
{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.Build.0 = Debug|Win32
{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.ActiveCfg = Debug|Win32
{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.ActiveCfg = Release|Win32
{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.Build.0 = Release|Win32
{4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.ActiveCfg = Release|Win32
+ {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|Win32.ActiveCfg = Release|Win32
+ {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|Win32.Build.0 = Release|Win32
+ {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.ActiveCfg = Release|Win32
{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.ActiveCfg = Debug|Win32
{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.Build.0 = Debug|Win32
{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.ActiveCfg = Debug|Win32
{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.ActiveCfg = Release|Win32
{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.Build.0 = Release|Win32
{71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.ActiveCfg = Release|Win32
+ {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|Win32.ActiveCfg = Release|Win32
+ {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|Win32.Build.0 = Release|Win32
+ {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.ActiveCfg = Release|Win32
{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.ActiveCfg = Debug|Win32
{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.Build.0 = Debug|Win32
{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64.ActiveCfg = Debug|Win32
{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.ActiveCfg = Release|Win32
{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.Build.0 = Release|Win32
{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.ActiveCfg = Release|Win32
+ {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|Win32.ActiveCfg = Release|Win32
+ {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|Win32.Build.0 = Release|Win32
+ {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64.ActiveCfg = Release|Win32
{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|Win32.ActiveCfg = Debug|Win32
{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|Win32.Build.0 = Debug|Win32
{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x64.ActiveCfg = Debug|Win32
{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|Win32.ActiveCfg = Release|Win32
{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|Win32.Build.0 = Release|Win32
{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x64.ActiveCfg = Release|Win32
+ {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|Win32.ActiveCfg = Release|Win32
+ {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|Win32.Build.0 = Release|Win32
+ {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x64.ActiveCfg = Release|Win32
{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|Win32.ActiveCfg = Debug|Win32
{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|Win32.Build.0 = Debug|Win32
{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x64.ActiveCfg = Debug|Win32
{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|Win32.ActiveCfg = Release|Win32
{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|Win32.Build.0 = Release|Win32
{988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x64.ActiveCfg = Release|Win32
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|Win32.ActiveCfg = Release DirectSound|Win32
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|Win32.Build.0 = Release DirectSound|Win32
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64.ActiveCfg = Release DirectSound|Win32
{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.ActiveCfg = Debug|Win32
{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug|Win32
{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug|Win32
{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release|Win32
{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release|Win32
{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|Win32
+ {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|Win32.ActiveCfg = Release|Win32
+ {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|Win32.Build.0 = Release|Win32
+ {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64.ActiveCfg = Release|Win32
{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|Win32.ActiveCfg = Debug|Win32
{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|Win32.Build.0 = Debug|Win32
{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x64.ActiveCfg = Debug|Win32
{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|Win32.ActiveCfg = Release|Win32
{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|Win32.Build.0 = Release|Win32
{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x64.ActiveCfg = Release|Win32
+ {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|Win32.ActiveCfg = Release Passthrough|Win32
+ {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|Win32.Build.0 = Release Passthrough|Win32
+ {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x64.ActiveCfg = Release Passthrough|Win32
{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32
{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|Win32.Build.0 = Debug Passthrough|Win32
{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x64.ActiveCfg = Debug|Win32
{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|Win32.ActiveCfg = Release Passthrough|Win32
{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|Win32.Build.0 = Release Passthrough|Win32
{8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x64.ActiveCfg = Release|Win32
+ {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|Win32.ActiveCfg = Release|Win32
+ {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|Win32.Build.0 = Release|Win32
+ {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x64.ActiveCfg = Release|Win32
{2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|Win32.ActiveCfg = Debug|Win32
{2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|Win32.Build.0 = Debug|Win32
{2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x64.ActiveCfg = Debug|Win32
{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|Win32.ActiveCfg = Release|Win32
{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|Win32.Build.0 = Release|Win32
{2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x64.ActiveCfg = Release|Win32
+ {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|Win32.ActiveCfg = Release|Win32
+ {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|Win32.Build.0 = Release|Win32
+ {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x64.ActiveCfg = Release|Win32
{3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|Win32.ActiveCfg = Debug|Win32
{3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|Win32.Build.0 = Debug|Win32
{3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x64.ActiveCfg = Debug|Win32
{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|Win32.ActiveCfg = Release|Win32
{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|Win32.Build.0 = Release|Win32
{3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x64.ActiveCfg = Release|Win32
+ {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|Win32.ActiveCfg = Release|Win32
+ {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|Win32.Build.0 = Release|Win32
+ {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x64.ActiveCfg = Release|Win32
{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|Win32.ActiveCfg = Debug|Win32
{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|Win32.Build.0 = Debug|Win32
{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x64.ActiveCfg = Debug|Win32
{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|Win32.ActiveCfg = Release|Win32
{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|Win32.Build.0 = Release|Win32
{2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x64.ActiveCfg = Release|Win32
+ {028C7278-05D7-4E18-82FE-BE231B844F41}.All|Win32.ActiveCfg = Release|Win32
+ {028C7278-05D7-4E18-82FE-BE231B844F41}.All|Win32.Build.0 = Release|Win32
+ {028C7278-05D7-4E18-82FE-BE231B844F41}.All|x64.ActiveCfg = Release|Win32
{028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.ActiveCfg = Debug|Win32
{028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.Build.0 = Debug|Win32
{028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64.ActiveCfg = Debug|Win32
{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.ActiveCfg = Release|Win32
{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.Build.0 = Release|Win32
{028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.ActiveCfg = Release|Win32
+ {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|Win32.ActiveCfg = Release|Win32
+ {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|Win32.Build.0 = Release|Win32
+ {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64.ActiveCfg = Release|Win32
{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|Win32.ActiveCfg = Debug|Win32
{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|Win32.Build.0 = Debug|Win32
{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x64.ActiveCfg = Debug|Win32
{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|Win32.ActiveCfg = Release|Win32
{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|Win32.Build.0 = Release|Win32
{D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x64.ActiveCfg = Release|Win32
+ {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|Win32.ActiveCfg = Release|Win32
+ {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|Win32.Build.0 = Release|Win32
+ {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x64.ActiveCfg = Release|Win32
{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|Win32.ActiveCfg = Debug|Win32
{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|Win32.Build.0 = Debug|Win32
{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x64.ActiveCfg = Debug|Win32
{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|Win32.ActiveCfg = Release|Win32
{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|Win32.Build.0 = Release|Win32
{5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x64.ActiveCfg = Release|Win32
+ {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|Win32.ActiveCfg = Release|Win32
+ {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|Win32.Build.0 = Release|Win32
+ {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x64.ActiveCfg = Release|Win32
{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|Win32.ActiveCfg = Debug|Win32
{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|Win32.Build.0 = Debug|Win32
{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x64.ActiveCfg = Debug|Win32
{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|Win32.ActiveCfg = Release|Win32
{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|Win32.Build.0 = Release|Win32
{FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x64.ActiveCfg = Release|Win32
+ {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|Win32.ActiveCfg = Release|Win32
+ {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|Win32.Build.0 = Release|Win32
+ {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x64.ActiveCfg = Release|Win32
{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|Win32.ActiveCfg = Debug|Win32
{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|Win32.Build.0 = Debug|Win32
{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x64.ActiveCfg = Debug|Win32
{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|Win32.ActiveCfg = Release|Win32
{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|Win32.Build.0 = Release|Win32
{06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x64.ActiveCfg = Release|Win32
+ {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|Win32.ActiveCfg = Release|Win32
+ {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|Win32.Build.0 = Release|Win32
+ {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x64.ActiveCfg = Release|Win32
{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|Win32.ActiveCfg = Debug|Win32
{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|Win32.Build.0 = Debug|Win32
{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x64.ActiveCfg = Debug|Win32
{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|Win32.ActiveCfg = Release|Win32
{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|Win32.Build.0 = Release|Win32
{6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x64.ActiveCfg = Release|Win32
+ {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|Win32.ActiveCfg = Release|Win32
+ {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|Win32.Build.0 = Release|Win32
+ {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x64.ActiveCfg = Release|Win32
{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|Win32.ActiveCfg = Debug|Win32
{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|Win32.Build.0 = Debug|Win32
{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x64.ActiveCfg = Debug|Win32
{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|Win32.ActiveCfg = Release|Win32
{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|Win32.Build.0 = Release|Win32
{A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x64.ActiveCfg = Release|Win32
+ {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|Win32.ActiveCfg = Release|Win32
+ {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|Win32.Build.0 = Release|Win32
+ {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x64.ActiveCfg = Release|Win32
{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|Win32.ActiveCfg = Debug|Win32
{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|Win32.Build.0 = Debug|Win32
{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x64.ActiveCfg = Debug|Win32
{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|Win32.ActiveCfg = Release|Win32
{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|Win32.Build.0 = Release|Win32
{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x64.ActiveCfg = Release|Win32
+ {F6A33240-8F29-48BD-98F0-826995911799}.All|Win32.ActiveCfg = Release|Win32
+ {F6A33240-8F29-48BD-98F0-826995911799}.All|Win32.Build.0 = Release|Win32
+ {F6A33240-8F29-48BD-98F0-826995911799}.All|x64.ActiveCfg = Release|Win32
{F6A33240-8F29-48BD-98F0-826995911799}.Debug|Win32.ActiveCfg = Debug|Win32
{F6A33240-8F29-48BD-98F0-826995911799}.Debug|Win32.Build.0 = Debug|Win32
{F6A33240-8F29-48BD-98F0-826995911799}.Debug|x64.ActiveCfg = Debug|Win32
{F6A33240-8F29-48BD-98F0-826995911799}.Release|Win32.ActiveCfg = Release|Win32
{F6A33240-8F29-48BD-98F0-826995911799}.Release|Win32.Build.0 = Release|Win32
{F6A33240-8F29-48BD-98F0-826995911799}.Release|x64.ActiveCfg = Release|Win32
+ {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|Win32.ActiveCfg = Release|Win32
+ {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|Win32.Build.0 = Release|Win32
+ {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x64.ActiveCfg = Release|Win32
{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|Win32.ActiveCfg = Debug|Win32
{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|Win32.Build.0 = Debug|Win32
{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x64.ActiveCfg = Debug|Win32
{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|Win32.ActiveCfg = Release|Win32
{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|Win32.Build.0 = Release|Win32
{65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x64.ActiveCfg = Release|Win32
+ {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|Win32.ActiveCfg = Release|Win32
+ {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|Win32.Build.0 = Release|Win32
+ {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x64.ActiveCfg = Release|Win32
{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|Win32.ActiveCfg = Debug|Win32
{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|Win32.Build.0 = Debug|Win32
{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x64.ActiveCfg = Debug|Win32
{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|Win32.ActiveCfg = Release|Win32
{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|Win32.Build.0 = Release|Win32
{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x64.ActiveCfg = Release|Win32
+ {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|Win32.ActiveCfg = Release|Win32
+ {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|Win32.Build.0 = Release|Win32
+ {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x64.ActiveCfg = Release|Win32
{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|Win32.ActiveCfg = Debug|Win32
{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|Win32.Build.0 = Debug|Win32
{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x64.ActiveCfg = Debug|Win32
{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|Win32.ActiveCfg = Release|Win32
{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|Win32.Build.0 = Release|Win32
{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x64.ActiveCfg = Release|Win32
+ {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|Win32.ActiveCfg = Release|Win32
+ {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|Win32.Build.0 = Release|Win32
+ {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x64.ActiveCfg = Release|Win32
{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|Win32.ActiveCfg = Debug|Win32
{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|Win32.Build.0 = Debug|Win32
{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x64.ActiveCfg = Debug|Win32
{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|Win32.ActiveCfg = Release|Win32
{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|Win32.Build.0 = Release|Win32
{44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x64.ActiveCfg = Release|Win32
+ {1A789A98-71EF-4EBD-8007-FC9ED585D32E}.All|Win32.ActiveCfg = Release|Win32
+ {1A789A98-71EF-4EBD-8007-FC9ED585D32E}.All|Win32.Build.0 = Release|Win32
+ {1A789A98-71EF-4EBD-8007-FC9ED585D32E}.All|x64.ActiveCfg = Release|Win32
{1A789A98-71EF-4EBD-8007-FC9ED585D32E}.Debug|Win32.ActiveCfg = Debug|Win32
{1A789A98-71EF-4EBD-8007-FC9ED585D32E}.Debug|Win32.Build.0 = Debug|Win32
{1A789A98-71EF-4EBD-8007-FC9ED585D32E}.Debug|x64.ActiveCfg = Debug|Win32
{1A789A98-71EF-4EBD-8007-FC9ED585D32E}.Release|Win32.ActiveCfg = Release|Win32
{1A789A98-71EF-4EBD-8007-FC9ED585D32E}.Release|Win32.Build.0 = Release|Win32
{1A789A98-71EF-4EBD-8007-FC9ED585D32E}.Release|x64.ActiveCfg = Release|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.ActiveCfg = Debug|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.Build.0 = Debug|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.ActiveCfg = Debug|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.ActiveCfg = Release|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.Build.0 = Release|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.ActiveCfg = Release|Win32
+ {9EED03C8-8315-4214-8D13-8FF5FA46D93C}.All|Win32.ActiveCfg = Release|Win32
+ {9EED03C8-8315-4214-8D13-8FF5FA46D93C}.All|Win32.Build.0 = Release|Win32
+ {9EED03C8-8315-4214-8D13-8FF5FA46D93C}.All|x64.ActiveCfg = Release|Win32
{9EED03C8-8315-4214-8D13-8FF5FA46D93C}.Debug|Win32.ActiveCfg = Debug|Win32
{9EED03C8-8315-4214-8D13-8FF5FA46D93C}.Debug|Win32.Build.0 = Debug|Win32
{9EED03C8-8315-4214-8D13-8FF5FA46D93C}.Debug|x64.ActiveCfg = Debug|Win32
{9EED03C8-8315-4214-8D13-8FF5FA46D93C}.Release|Win32.ActiveCfg = Release|Win32
{9EED03C8-8315-4214-8D13-8FF5FA46D93C}.Release|Win32.Build.0 = Release|Win32
{9EED03C8-8315-4214-8D13-8FF5FA46D93C}.Release|x64.ActiveCfg = Release|Win32
+ {2CCED6DC-26FF-40F2-9585-E9E1049A4599}.All|Win32.ActiveCfg = Release|Win32
+ {2CCED6DC-26FF-40F2-9585-E9E1049A4599}.All|Win32.Build.0 = Release|Win32
+ {2CCED6DC-26FF-40F2-9585-E9E1049A4599}.All|x64.ActiveCfg = Release|Win32
{2CCED6DC-26FF-40F2-9585-E9E1049A4599}.Debug|Win32.ActiveCfg = Debug|Win32
{2CCED6DC-26FF-40F2-9585-E9E1049A4599}.Debug|Win32.Build.0 = Debug|Win32
{2CCED6DC-26FF-40F2-9585-E9E1049A4599}.Debug|x64.ActiveCfg = Debug|Win32
{2CCED6DC-26FF-40F2-9585-E9E1049A4599}.Release|Win32.ActiveCfg = Release|Win32
{2CCED6DC-26FF-40F2-9585-E9E1049A4599}.Release|Win32.Build.0 = Release|Win32
{2CCED6DC-26FF-40F2-9585-E9E1049A4599}.Release|x64.ActiveCfg = Release|Win32
+ {4AE157CF-F2DD-4B5D-A1EE-4AC173B4F9AC}.All|Win32.ActiveCfg = Release|Win32
+ {4AE157CF-F2DD-4B5D-A1EE-4AC173B4F9AC}.All|Win32.Build.0 = Release|Win32
+ {4AE157CF-F2DD-4B5D-A1EE-4AC173B4F9AC}.All|x64.ActiveCfg = Release|Win32
{4AE157CF-F2DD-4B5D-A1EE-4AC173B4F9AC}.Debug|Win32.ActiveCfg = Debug|Win32
{4AE157CF-F2DD-4B5D-A1EE-4AC173B4F9AC}.Debug|Win32.Build.0 = Debug|Win32
{4AE157CF-F2DD-4B5D-A1EE-4AC173B4F9AC}.Debug|x64.ActiveCfg = Debug|Win32
{4AE157CF-F2DD-4B5D-A1EE-4AC173B4F9AC}.Release|Win32.ActiveCfg = Release|Win32
{4AE157CF-F2DD-4B5D-A1EE-4AC173B4F9AC}.Release|Win32.Build.0 = Release|Win32
{4AE157CF-F2DD-4B5D-A1EE-4AC173B4F9AC}.Release|x64.ActiveCfg = Release|Win32
+ {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|Win32.ActiveCfg = Release|Win32
+ {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|Win32.Build.0 = Release|Win32
+ {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64.ActiveCfg = Release|Win32
{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|Win32.ActiveCfg = Debug|Win32
{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|Win32.Build.0 = Debug|Win32
{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x64.ActiveCfg = Debug|Win32
{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.ActiveCfg = Release|Win32
{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.Build.0 = Release|Win32
{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.ActiveCfg = Release|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|Win32.ActiveCfg = Release|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|Win32.Build.0 = Release|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x64.ActiveCfg = Release|Win32
{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.ActiveCfg = Debug|Win32
{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.Build.0 = Debug|Win32
{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64.ActiveCfg = Debug|Win32
{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.ActiveCfg = Release|Win32
{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.Build.0 = Release|Win32
{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.ActiveCfg = Release|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.All|Win32.ActiveCfg = Release|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.All|Win32.Build.0 = Release|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.All|x64.ActiveCfg = Release|Win32
{B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.ActiveCfg = Debug|Win32
{B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.Build.0 = Debug|Win32
{B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64.ActiveCfg = Debug|Win32
{B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.ActiveCfg = Release|Win32
{B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.Build.0 = Release|Win32
{B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.ActiveCfg = Release|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|Win32.ActiveCfg = Release|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|Win32.Build.0 = Release|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x64.ActiveCfg = Release|Win32
{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.ActiveCfg = Debug|Win32
{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.Build.0 = Debug|Win32
{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64.ActiveCfg = Debug|Win32
{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.ActiveCfg = Release|Win32
{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.Build.0 = Release|Win32
{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.ActiveCfg = Release|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|Win32.ActiveCfg = Debug|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|Win32.Build.0 = Debug|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x64.ActiveCfg = Debug|Win32
{0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.ActiveCfg = Debug|Win32
{0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.Build.0 = Debug|Win32
{0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64.ActiveCfg = Debug|Win32
{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.ActiveCfg = Release|Win32
{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.Build.0 = Release|Win32
{0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.ActiveCfg = Release|Win32
+ {426B1369-FDB7-4B18-A7EF-9C6A9097A130}.All|Win32.ActiveCfg = Release|Win32
+ {426B1369-FDB7-4B18-A7EF-9C6A9097A130}.All|Win32.Build.0 = Release|Win32
+ {426B1369-FDB7-4B18-A7EF-9C6A9097A130}.All|x64.ActiveCfg = Release|Win32
{426B1369-FDB7-4B18-A7EF-9C6A9097A130}.Debug|Win32.ActiveCfg = Debug|Win32
{426B1369-FDB7-4B18-A7EF-9C6A9097A130}.Debug|Win32.Build.0 = Debug|Win32
{426B1369-FDB7-4B18-A7EF-9C6A9097A130}.Debug|x64.ActiveCfg = Debug|Win32
{426B1369-FDB7-4B18-A7EF-9C6A9097A130}.Release|Win32.ActiveCfg = Release|Win32
{426B1369-FDB7-4B18-A7EF-9C6A9097A130}.Release|Win32.Build.0 = Release|Win32
{426B1369-FDB7-4B18-A7EF-9C6A9097A130}.Release|x64.ActiveCfg = Release|Win32
+ {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|Win32.ActiveCfg = Release_Dynamic_SSE|Win32
+ {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|Win32.Build.0 = Release_Dynamic_SSE|Win32
+ {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x64.ActiveCfg = Release_Dynamic_SSE|Win32
{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.ActiveCfg = Debug|Win32
{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.Build.0 = Debug|Win32
{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x64.ActiveCfg = Debug|Win32
{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.ActiveCfg = Release|Win32
{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.Build.0 = Release|Win32
{E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x64.ActiveCfg = Release|Win32
+ {E42FDC95-7243-4219-9EA4-ACCE4AB97197}.All|Win32.ActiveCfg = Release_Dynamic_SSE|Win32
+ {E42FDC95-7243-4219-9EA4-ACCE4AB97197}.All|Win32.Build.0 = Release_Dynamic_SSE|Win32
+ {E42FDC95-7243-4219-9EA4-ACCE4AB97197}.All|x64.ActiveCfg = Release_Dynamic_SSE|Win32
{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Debug|Win32.ActiveCfg = Debug|Win32
{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Debug|Win32.Build.0 = Debug|Win32
{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Debug|x64.ActiveCfg = Debug|Win32
{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release|Win32.ActiveCfg = Release|Win32
{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release|Win32.Build.0 = Release|Win32
{E42FDC95-7243-4219-9EA4-ACCE4AB97197}.Release|x64.ActiveCfg = Release|Win32
+ {7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.All|Win32.ActiveCfg = Release|Win32
+ {7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.All|Win32.Build.0 = Release|Win32
+ {7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.All|x64.ActiveCfg = Release|Win32
{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.Debug|Win32.ActiveCfg = Debug|Win32
{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.Debug|Win32.Build.0 = Debug|Win32
{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.Debug|x64.ActiveCfg = Debug|Win32
{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.Release|Win32.ActiveCfg = Release|Win32
{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.Release|Win32.Build.0 = Release|Win32
{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}.Release|x64.ActiveCfg = Release|Win32
+ {D0B36172-CD76-454A-9B89-990025266C2A}.All|Win32.ActiveCfg = Release|Win32
+ {D0B36172-CD76-454A-9B89-990025266C2A}.All|Win32.Build.0 = Release|Win32
+ {D0B36172-CD76-454A-9B89-990025266C2A}.All|x64.ActiveCfg = Release|Win32
{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|Win32.ActiveCfg = Debug|Win32
{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|Win32.Build.0 = Debug|Win32
{D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x64.ActiveCfg = Debug|Win32
{D0B36172-CD76-454A-9B89-990025266C2A}.Release|Win32.ActiveCfg = Release|Win32
{D0B36172-CD76-454A-9B89-990025266C2A}.Release|Win32.Build.0 = Release|Win32
{D0B36172-CD76-454A-9B89-990025266C2A}.Release|x64.ActiveCfg = Release|Win32
+ {AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.All|Win32.ActiveCfg = Release|Win32
+ {AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.All|Win32.Build.0 = Release|Win32
+ {AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.All|x64.ActiveCfg = Release|Win32
{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.Debug|Win32.ActiveCfg = Debug|Win32
{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.Debug|Win32.Build.0 = Debug|Win32
{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.Debug|x64.ActiveCfg = Debug|Win32
{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.Release|Win32.ActiveCfg = Release|Win32
{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.Release|Win32.Build.0 = Release|Win32
{AEE5D1F8-3386-4CB2-A336-0125C4C7EAEE}.Release|x64.ActiveCfg = Release|Win32
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|Win32
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.Build.0 = Release|Win32
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.ActiveCfg = Release|Win32
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.ActiveCfg = Debug|Win32
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.ActiveCfg = Release|Win32
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|Win32
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.Build.0 = Release|Win32
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.ActiveCfg = Release|Win32
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.ActiveCfg = Debug|Win32
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.ActiveCfg = Release|Win32
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.ActiveCfg = Release|Win32
+ {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32
+ {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32
+ {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32
+ {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32
+ {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.Build.0 = All|Win32
+ {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.ActiveCfg = All|Win32
+ {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32
+ {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.Build.0 = All|Win32
+ {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.ActiveCfg = All|Win32
+ {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32
+ {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32
+ {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x64.ActiveCfg = All|Win32
+ {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32
+ {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.Build.0 = All|Win32
+ {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.ActiveCfg = All|Win32
+ {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32
+ {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.Build.0 = All|Win32
+ {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.ActiveCfg = All|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1410,7 +1722,6 @@
{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{0A18A071-125E-442F-AFF7-A3F68ABECF99} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
- {CF70F278-3364-4395-A2E1-23501C9B8AD2} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{B535402E-38D2-4D54-8360-423ACBD17192} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
@@ -1419,6 +1730,10 @@
{E42FDC95-7243-4219-9EA4-ACCE4AB97197} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{D0B36172-CD76-454A-9B89-990025266C2A} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {DEE932AB-5911-4700-9EEB-8C7090A0A330} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {329A6FA0-0FCC-4435-A950-E670AEFA9838} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000}
{ACFFF684-4D19-4D48-AF12-88EA1D778BDF} = {0C808854-54D1-4230-BFF5-77B5FD905000}
{8F992C49-6C51-412F-B2A3-34EAB708EB65} = {0C808854-54D1-4230-BFF5-77B5FD905000}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/Freeswitch.2008.express.sln (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/Freeswitch.2008.express.sln 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/Freeswitch.2008.express.sln 2009-11-02 10:10:22 UTC (rev 15314)
@@ -384,12 +384,11 @@
{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvoipcodecs", "libs\voipcodecs\libvoipcodecs.2008.vcproj", "{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_voipcodecs", "src\mod\codecs\mod_voipcodecs\mod_voipcodecs.2008.vcproj", "{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}"
ProjectSection(ProjectDependencies) = postProject
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {CF70F278-3364-4395-A2E1-23501C9B8AD2} = {CF70F278-3364-4395-A2E1-23501C9B8AD2}
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_fsv", "src\mod\applications\mod_fsv\mod_fsv.2008.vcproj", "{E3246D17-E29B-4AB5-962A-C69B0C5837BB}"
@@ -636,6 +635,11 @@
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_valet_parking", "src\mod\applications\mod_valet_parking\mod_valet_parking.2008.vcproj", "{432DB165-1EB2-4781-A9C0-71E62610B20A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Win32 = All|Win32
@@ -1441,17 +1445,6 @@
{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|Win32.Build.0 = Release|Win32
{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.ActiveCfg = Release|x64
{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.Build.0 = Release|x64
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|Win32.ActiveCfg = Release|x64
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x64.ActiveCfg = Release|x64
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x64.Build.0 = Release|x64
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.ActiveCfg = Debug|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.Build.0 = Debug|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.ActiveCfg = Debug|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.Build.0 = Debug|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.ActiveCfg = Release|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.Build.0 = Release|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.ActiveCfg = Release|x64
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.Build.0 = Release|x64
{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.All|Win32.ActiveCfg = Release|x64
{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.All|x64.ActiveCfg = Release|x64
{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.All|x64.Build.0 = Release|x64
@@ -2081,6 +2074,16 @@
{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|Win32.ActiveCfg = Release|Win32
{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|Win32.Build.0 = Release|Win32
{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|x64.ActiveCfg = Release|Win32
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.All|Win32.ActiveCfg = Release|x64
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.All|x64.ActiveCfg = Release|x64
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|Win32.Build.0 = Debug|Win32
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|x64.ActiveCfg = Debug|x64
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|x64.Build.0 = Debug|x64
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|Win32.ActiveCfg = Release|Win32
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|Win32.Build.0 = Release|Win32
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|x64.ActiveCfg = Release|x64
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/Freeswitch.2008.sln (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/Freeswitch.2008.sln 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/Freeswitch.2008.sln 2009-11-02 10:10:22 UTC (rev 15314)
@@ -757,12 +757,11 @@
{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvoipcodecs", "libs\voipcodecs\libvoipcodecs.2008.vcproj", "{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_voipcodecs", "src\mod\codecs\mod_voipcodecs\mod_voipcodecs.2008.vcproj", "{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}"
ProjectSection(ProjectDependencies) = postProject
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {CF70F278-3364-4395-A2E1-23501C9B8AD2} = {CF70F278-3364-4395-A2E1-23501C9B8AD2}
+ {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
+ {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_fsv", "src\mod\applications\mod_fsv\mod_fsv.2008.vcproj", "{E3246D17-E29B-4AB5-962A-C69B0C5837BB}"
@@ -1028,6 +1027,11 @@
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_valet_parking", "src\mod\applications\mod_valet_parking\mod_valet_parking.2008.vcproj", "{432DB165-1EB2-4781-A9C0-71E62610B20A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Win32 = All|Win32
@@ -1832,17 +1836,6 @@
{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|Win32.Build.0 = Release|Win32
{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.ActiveCfg = Release|x64
{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.Build.0 = Release|x64
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|Win32.ActiveCfg = Release|x64
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x64.ActiveCfg = Release|x64
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x64.Build.0 = Release|x64
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.ActiveCfg = Debug|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.Build.0 = Debug|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.ActiveCfg = Debug|x64
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.Build.0 = Debug|x64
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.ActiveCfg = Release|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.Build.0 = Release|Win32
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.ActiveCfg = Release|x64
- {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.Build.0 = Release|x64
{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.All|Win32.ActiveCfg = Release|x64
{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.All|x64.ActiveCfg = Release|x64
{42B6C2E3-7D5F-4204-A1F6-C0376B86C315}.All|x64.Build.0 = Release|x64
@@ -2507,6 +2500,16 @@
{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|Win32.Build.0 = Release|Win32
{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x64.ActiveCfg = Release|x64
{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x64.Build.0 = Release|x64
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.All|Win32.ActiveCfg = Release|x64
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.All|x64.ActiveCfg = Release|x64
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|Win32.Build.0 = Debug|Win32
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|x64.ActiveCfg = Debug|x64
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|x64.Build.0 = Debug|x64
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|Win32.ActiveCfg = Release|Win32
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|Win32.Build.0 = Release|Win32
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|x64.ActiveCfg = Release|x64
+ {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -2545,6 +2548,7 @@
{7877EFC8-4807-484B-B573-D7B7FD058FAA} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{3C977801-FE88-48F2-83D3-FA2EBFF6688E} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+ {432DB165-1EB2-4781-A9C0-71E62610B20A} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
{A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
@@ -2596,7 +2600,6 @@
{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{0A18A071-125E-442F-AFF7-A3F68ABECF99} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
- {CF70F278-3364-4395-A2E1-23501C9B8AD2} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{0D108721-EAE8-4BAF-8102-D8960EC93647} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/Makefile.am (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/Makefile.am 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/Makefile.am 2009-11-02 10:10:22 UTC (rev 15314)
@@ -299,7 +299,17 @@
fi ; \
fi ;
-update:
+is-svn:
+ @if [ ! -d .svn ] ; then \
+ echo ; echo ; \
+ echo "**************************************************************************************************" ; \
+ echo "You can not update a release tarball or without a svn working copy, please checkout fresh from svn" ; \
+ echo "**************************************************************************************************" ; \
+ echo ; echo ; \
+ exit 1; \
+ fi
+
+update: is-svn
@if test -d .svn ; then \
test ! -f .version || rm -f .version ; \
echo Updating... ; \
@@ -357,17 +367,17 @@
everything: install
-up: clean
+up: is-svn clean
svn update
$(MAKE) -j core
$(MAKE) -j modules
$(MAKE) install
-sync:
+sync: is-svn
svn update
$(MAKE) install
-speedy-sync:
+speedy-sync: is-svn
svn update
$(MAKE) -j install
@@ -386,7 +396,7 @@
@echo reswigging all
sh ./build/swigall.sh
-sure: update-clean all
+sure: current
speedy-sure: update-clean
$(MAKE) -j core
@@ -398,6 +408,13 @@
cd libs/speex && ./config.status --recheck
cd libs/speex && ./config.status
+tiff-reconf:
+ cd libs/tiff-3.8.2 && autoreconf -fi
+ cd libs/tiff-3.8.2 && sh ./configure.gnu
+ cd libs/spandsp && autoreconf -fi
+ cd libs/spandsp && sh ./configure.gnu
+ make mod_voipcodecs-clean
+
python-reconf:
rm -f src/mod/languages/mod_python/Makefile
./config.status
@@ -424,14 +441,14 @@
cd libs/sofia-sip && $(MAKE) clean
cd libs/sofia-sip && ./configure --prefix=$(PREFIX) --with-pic --with-glib=no --disable-shared
-current: update-clean
+current: is-svn update-clean
svn update
$(MAKE) all
$(MAKE) install
installall: current
-speedy-current: update-clean
+speedy-current: is-svn update-clean
svn update
$(MAKE) speedy-sure
$(MAKE) install
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/bootstrap.sh (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/bootstrap.sh 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/bootstrap.sh 2009-11-02 10:10:22 UTC (rev 15314)
@@ -3,11 +3,9 @@
BASEDIR=`pwd`;
LIBDIR=${BASEDIR}/libs;
-SUBDIRS="ilbc curl iksemel voipcodecs \
- js js/nsprpub libdingaling libedit libsndfile pcre sofia-sip \
- speex sqlite srtp openzap spandsp libg722_1 portaudio unimrcp";
+SUBDIRS="ilbc curl iksemel js js/nsprpub libdingaling libedit libsndfile pcre sofia-sip \
+ speex sqlite srtp openzap spandsp libg722_1 portaudio unimrcp tiff-3.8.2";
-
if [ ! -f modules.conf ]; then
cp build/modules.conf.in modules.conf
fi
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/build/modules.conf.in (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/build/modules.conf.in 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/build/modules.conf.in 2009-11-02 10:10:22 UTC (rev 15314)
@@ -10,6 +10,7 @@
#applications/mod_fax
#applications/mod_curl
applications/mod_voicemail
+#applications/mod_directory
#applications/mod_lcr
applications/mod_limit
applications/mod_expr
@@ -24,6 +25,7 @@
#applications/mod_memcache
#applications/mod_spy
applications/mod_cluechoo
+applications/mod_valet_parking
codecs/mod_g723_1
codecs/mod_amr
#codecs/mod_amrwb
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/cidlookup.conf.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/cidlookup.conf.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/cidlookup.conf.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -3,6 +3,10 @@
<!-- comment out url to not setup a url based lookup -->
<param name="url" value="http://query.voipcnam.com/query.php?api_key=MYAPIKEY&number=${caller_id_number}"/>
+ <!-- comment out whitepages-apikey to not use whitepages.com, you must
+ get an API key from http://developer.whitepages.com/ -->
+ <param name="whitepages-apikey" value="MYAPIKEY"/>
+
<!-- set to false to not cache (in memcache) results from the url query -->
<param name="cache" value="true"/>
<!-- expire is in seconds -->
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/directory.conf.xml (from rev 15313, freeswitch/trunk/conf/autoload_configs/directory.conf.xml) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/directory.conf.xml (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/directory.conf.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,19 @@
+<configuration name="directory.conf" description="Directory">
+ <settings>
+ </settings>
+ <profiles>
+ <profile name="default">
+ <param name="max-menu-attempts" value="3"/>
+ <param name="min-search-digits" value="3"/>
+ <param name="terminator-key" value="#"/>
+ <param name="digit-timeout" value="3000"/>
+ <param name="max-result" value="5"/>
+ <param name="next-key" value="6"/>
+ <param name="prev-key" value="4"/>
+ <param name="switch-order-key" value="*"/>
+ <param name="select-name-key" value="1"/>
+ <param name="new-search-key" value="3"/>
+ <param name="search-order" value="last_name"/>
+ </profile>
+ </profiles>
+</configuration>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/fifo.conf.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/fifo.conf.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/fifo.conf.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1,4 +1,7 @@
<configuration name="fifo.conf" description="FIFO Configuration">
+ <settings>
+ <param name="delete-all-outbound-member-on-startup" value="false"/>
+ </settings>
<fifos>
<fifo name="cool_fifo@$${domain}" importance="0">
<!--<member timeout="60" simo="1" lag="20">{member_wait=nowait}user/1005@$${domain}</member>-->
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/modules.conf.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/modules.conf.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/modules.conf.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -44,12 +44,14 @@
<load module="mod_expr"/>
<load module="mod_fifo"/>
<load module="mod_voicemail"/>
+ <!--<load module="mod_directory"/>-->
<!--<load module="mod_fax"/>-->
<!--<load module="mod_lcr"/>-->
<load module="mod_limit"/>
<load module="mod_esf"/>
<load module="mod_fsv"/>
<load module="mod_cluechoo"/>
+ <load module="mod_valet_parking"/>
<!--<load module="mod_spy"/>-->
<!-- SNOM Module -->
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/syslog.conf.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/syslog.conf.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/syslog.conf.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -9,6 +9,7 @@
<!-- info - informational message -->
<!-- debug - debug-level message -->
<settings>
+ <param name="facility" value="user"/>
<param name="ident" value="freeswitch"/>
<param name="loglevel" value="warning"/>
</settings>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/xml_curl.conf.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/xml_curl.conf.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/autoload_configs/xml_curl.conf.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -8,6 +8,7 @@
<!-- <param name="gateway-url" value="http://www.freeswitch.org/gateway.xml" bindings="dialplan"/> -->
<!-- set this to provide authentication credentials to the server -->
<!--<param name="gateway-credentials" value="muser:mypass"/>-->
+ <!--<param name="auth-scheme" value="basic"/>-->
<!-- set to true to disable Expect: 100-continue lighttpd requires this setting -->
<!--<param name="disable-100-continue" value="true"/>-->
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/dialplan/default.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/dialplan/default.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/dialplan/default.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -7,7 +7,7 @@
Authenticated users will use the user_context variable on the user to determine what context
they can access. You can also add a user in the directory with the cidr= attribute acl.conf.xml
- will build the domains acl using this value.
+ will build the domains ACL using this value.
-->
<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
<include>
@@ -110,7 +110,7 @@
</extension>
-->
<!--
- snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
+ Snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
-->
<extension name="snom-demo-2">
@@ -296,7 +296,7 @@
</condition>
</extension>
- <!-- dial the freeswitch conference via SIP-->
+ <!-- dial the FreeSWITCH conference via SIP-->
<extension name="freeswitch_public_conf_via_sip">
<condition field="destination_number" expression="^9(888|1616|3232)$">
<action application="export" data="hold_music=silence"/>
@@ -406,8 +406,32 @@
</condition>
</extension>
+ <!--
+ Valet park retrieval, works with valet_park extension below.
+ Retrieve a valet parked call by dialing 6000 + park number + #
+ -->
+ <extension name="valet_park">
+ <condition field="destination_number" expression="^(6000)$">
+ <action application="answer"/>
+ <action application="valet_park" data="valet_parking_lot ask 1 11 10000 ivr/ivr-enter_ext_pound.wav"/>
+ </condition>
+ </extension>
+
+ <!--
+ Valet park 6001-6099. Blind x-fer to 6001, 6002, etc. to valet park the call.
+ Dial 6001, 6002, etc. to retrieve a call that is already valet parked.
+ After call is retrieved, park extension is free for another call.
+ -->
+ <extension name="valet_park">
+ <condition field="destination_number" expression="^(60\d[1-9])$">
+ <action application="answer"/>
+ <action application="valet_park" data="valet_parking_lot $1"/>
+ </condition>
+ </extension>
+
+
<!--
- This extension is used with snom phones.
+ This extension is used with Snom phones.
Set a function key to park+lot (lot being a number or name.)
Set type to Park+Orbit. You can then park and pickup using
@@ -433,7 +457,7 @@
</extension>
<!--
- This extension is used with linksys phones.
+ This extension is used with Linksys phones.
Set a Phone tab option Call Park Serv to yes. You can park and
pickup using soft keys "park" and "unpark" found during
@@ -450,7 +474,7 @@
</extension>
<!--
- This extension is used with linksys phones.
+ This extension is used with Linksys phones.
The extension is parking pickup with a to param of the fifo
we are calling. Linksys sends orbit=<parkingslotnumber>
@@ -549,8 +573,8 @@
<extension name="ClueCon">
<condition field="destination_number" expression="^9991$">
- <action application="set" data="effective_caller_id_name=ClueCon"/>
- <action application="bridge" data="sofia/$${domain}/brian@bkw.org"/>
+ <action application="set" data="effective_caller_id_name=ClueCon IVR"/>
+ <action application="bridge" data="sofia/$${domain}/2000@bkw.org"/>
</condition>
</extension>
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/dir (from rev 15313, freeswitch/trunk/conf/lang/en/dir)
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/dir/sounds.xml
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/dir/sounds.xml (from rev 15313, freeswitch/trunk/conf/lang/en/dir/sounds.xml) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/dir/sounds.xml (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/dir/sounds.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,121 @@
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+ <macro name="directory_intro">
+ <input pattern="^(last_name)" break_on_match="false">
+ <match>
+ <action function="play-file" data="directory/dir-enter-person.wav"/>
+ <action function="play-file" data="directory/dir-last_name.wav"/>
+ </match>
+ </input>
+ <input pattern="^(first_name)" break_on_match="false">
+ <match>
+ <action function="play-file" data="directory/dir-enter-person.wav"/>
+ <action function="play-file" data="directory/dir-first_name.wav"/>
+ </match>
+ </input>
+ <input pattern="^(last_name):([0-9#*])$" break_on_match="false">
+ <match>
+ <action function="play-file" data="directory/dir-to_search_by.wav"/>
+ <action function="play-file" data="directory/dir-first_name.wav"/>
+ <action function="play-file" data="directory/dir-press.wav"/>
+ <action function="say" data="$2" method="pronounced" type="name_spelled"/>
+ </match>
+ </input>
+ <input pattern="^(first_name):([0-9#*])$" break_on_match="false">
+ <match>
+ <action function="play-file" data="directory/dir-to_search_by.wav"/>
+ <action function="play-file" data="directory/dir-last_name.wav"/>
+ <action function="play-file" data="directory/dir-press.wav"/>
+ <action function="say" data="$2" method="pronounced" type="name_spelled"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_min_search_digits">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="play-file" data="directory/dir-specify_mininum_first.wav"/>
+ <action function="say" data="$1" method="pronounced" type="items"/>
+ <action function="play-file" data="directory/dir-letters_of_person_name.wav"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_count">
+ <input pattern="^0$" break_on_match="true">
+ <match>
+ <action function="play-file" data="directory/dir-no_match_entry.wav"/>
+ </match>
+ </input>
+ <input pattern="^(.*)$">
+ <match>
+ <action function="say" data="$1" method="pronounced" type="items"/>
+ <action function="play-file" data="directory/dir-result_match.wav"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_count_too_large">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="play-file" data="directory/dir-to_many_result.wav"/>
+ </match>
+ </input>
+
+ </macro>
+
+ <macro name="directory_result_last">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="play-file" data="directory/dir-no_more_result.wav"/>
+ </match>
+ </input>
+
+ </macro>
+
+ <macro name="directory_result_item">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="play-file" data="directory/dir-result_number.wav"/>
+ <action function="say" data="$1" method="pronounced" type="items"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_at">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="play-file" data="directory/dir-at_extension.wav"/>
+ <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_menu">
+ <input pattern="^([0-9#*]),([0-9#*]),([0-9#*]),([0-9#*])$">
+ <match>
+ <action function="play-file" data="directory/dir-to_select_entry.wav"/>
+ <action function="play-file" data="directory/dir-press.wav"/>
+ <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+ <action function="play-file" data="directory/dir-for_next.wav"/>
+ <action function="play-file" data="directory/dir-press.wav"/>
+ <action function="say" data="$2" method="pronounced" type="name_spelled"/>
+ <action function="play-file" data="directory/dir-for_prev.wav"/>
+ <action function="play-file" data="directory/dir-press.wav"/>
+ <action function="say" data="$3" method="pronounced" type="name_spelled"/>
+ <action function="play-file" data="directory/dir-to_make_new_search.wav"/>
+ <action function="play-file" data="directory/dir-press.wav"/>
+ <action function="say" data="$4" method="pronounced" type="name_spelled"/>
+
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_say_name">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+ </match>
+ </input>
+ </macro>
+
+</include><!--This line will be ignored it's here to validate the xml and is optional -->
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/dir/tts.xml
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/dir/tts.xml (from rev 15313, freeswitch/trunk/conf/lang/en/dir/tts.xml) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/dir/tts.xml (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/dir/tts.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,96 @@
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+
+ <macro name="directory_intro">
+ <input pattern="^(last_name)" break_on_match="false">
+ <match>
+ <action function="speak-text" data="Please enter the first few digit of the person last name"/>
+ </match>
+ </input>
+ <input pattern="^(first_name)" break_on_match="false">
+ <match>
+ <action function="speak-text" data="Please enter the first few digit of the person first name"/>
+ </match>
+ </input>
+ <input pattern="^(last_name):([0-9#*])$" break_on_match="false">
+ <match>
+ <action function="speak-text" data="to search by first name, press $2"/>
+ </match>
+ </input>
+ <input pattern="^(first_name):([0-9#*])$" break_on_match="false">
+ <match>
+ <action function="speak-text" data="to search by last name, press $2"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_min_search_digits">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="You need to specify a minimum the first $1 letters of the person name, try again."/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_count">
+ <input pattern="^0$" break_on_match="true">
+ <match>
+ <action function="speak-text" data="Your search match no user on this system, try again."/>
+ </match>
+ </input>
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="$1 result match your search"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_count_too_large">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="Your search returned too many result, please try again"/>
+ </match>
+ </input>
+
+ </macro>
+
+ <macro name="directory_result_last">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="No more result"/>
+ </match>
+ </input>
+
+ </macro>
+
+ <macro name="directory_result_item">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="Result number $1"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_menu">
+ <input pattern="^([0-9#*]),([0-9#*]),([0-9#*]),([0-9#*])$">
+ <match>
+ <action function="speak-text" data="To select this entry press $1, for the next entry press $2, for the previous entry press $3, to make a new search press $4"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_at">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="at extension $1"/>
+ </match>
+ </input>
+ </macro>
+ <macro name="directory_result_say_name">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="$1"/>
+ </match>
+ </input>
+ </macro>
+
+</include><!--This line will be ignored it's here to validate the xml and is optional -->
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/en.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/en.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/en.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -3,5 +3,6 @@
<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 -->
+ <X-PRE-PROCESS cmd="include" data="dir/sounds.xml"/> <!-- dir/tts.xml if you want to use tts and have cepstral -->
</language>
</include>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/vm/sounds.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/vm/sounds.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/en/vm/sounds.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -340,5 +340,30 @@
</input>
</macro>
+ <macro name="valet_announce_ext">
+ <input pattern="^([^\:]+):(.*)$">
+ <match>
+ <action function="say" data="$2" method="pronounced" type="name_spelled"/>
+ </match>
+ </input>
+ </macro>
+ <macro name="valet_lot_full">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="play-file" data="tone_stream://%(275,10,600);%(275,100,300)"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="valet_lot_empty">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="play-file" data="tone_stream://%(275,10,600);%(275,100,300)"/>
+ </match>
+ </input>
+ </macro>
+
+
+
</include><!--This line will be ignored it's here to validate the xml and is optional -->
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/fr/dir (from rev 15313, freeswitch/trunk/conf/lang/fr/dir)
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/fr/dir/sounds.xml
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/fr/dir/sounds.xml (from rev 15313, freeswitch/trunk/conf/lang/fr/dir/sounds.xml) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/fr/dir/sounds.xml (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/fr/dir/sounds.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,121 @@
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+ <macro name="directory_intro">
+ <input pattern="^(last_name)" break_on_match="false">
+ <match>
+ <action function="play-file" data="directory/dir-enter-person.wav"/>
+ <action function="play-file" data="directory/dir-last_name.wav"/>
+ </match>
+ </input>
+ <input pattern="^(first_name)" break_on_match="false">
+ <match>
+ <action function="play-file" data="directory/dir-enter-person.wav"/>
+ <action function="play-file" data="directory/dir-first_name.wav"/>
+ </match>
+ </input>
+ <input pattern="^(last_name):([0-9#*])$" break_on_match="false">
+ <match>
+ <action function="play-file" data="directory/dir-to_search_by.wav"/>
+ <action function="play-file" data="directory/dir-first_name.wav"/>
+ <action function="play-file" data="directory/dir-press.wav"/>
+ <action function="say" data="$2" method="pronounced" type="name_spelled"/>
+ </match>
+ </input>
+ <input pattern="^(first_name):([0-9#*])$" break_on_match="false">
+ <match>
+ <action function="play-file" data="directory/dir-to_search_by.wav"/>
+ <action function="play-file" data="directory/dir-last_name.wav"/>
+ <action function="play-file" data="directory/dir-press.wav"/>
+ <action function="say" data="$2" method="pronounced" type="name_spelled"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_min_search_digits">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="play-file" data="directory/dir-specify_mininum_first.wav"/>
+ <action function="say" data="$1" method="pronounced" type="items"/>
+ <action function="play-file" data="directory/dir-letters_of_person_name.wav"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_count">
+ <input pattern="^0$" break_on_match="true">
+ <match>
+ <action function="play-file" data="directory/dir-no_match_entry.wav"/>
+ </match>
+ </input>
+ <input pattern="^(.*)$">
+ <match>
+ <action function="say" data="$1" method="pronounced" type="items"/>
+ <action function="play-file" data="directory/dir-result_match.wav"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_count_too_large">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="play-file" data="directory/dir-to_many_result.wav"/>
+ </match>
+ </input>
+
+ </macro>
+
+ <macro name="directory_result_last">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="play-file" data="directory/dir-no_more_result.wav"/>
+ </match>
+ </input>
+
+ </macro>
+
+ <macro name="directory_result_item">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="play-file" data="directory/dir-result_number.wav"/>
+ <action function="say" data="$1" method="pronounced" type="items"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_at">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="play-file" data="directory/dir-at_extension.wav"/>
+ <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_menu">
+ <input pattern="^([0-9#*]),([0-9#*]),([0-9#*]),([0-9#*])$">
+ <match>
+ <action function="play-file" data="directory/dir-to_select_entry.wav"/>
+ <action function="play-file" data="directory/dir-press.wav"/>
+ <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+ <action function="play-file" data="directory/dir-for_next.wav"/>
+ <action function="play-file" data="directory/dir-press.wav"/>
+ <action function="say" data="$2" method="pronounced" type="name_spelled"/>
+ <action function="play-file" data="directory/dir-for_prev.wav"/>
+ <action function="play-file" data="directory/dir-press.wav"/>
+ <action function="say" data="$3" method="pronounced" type="name_spelled"/>
+ <action function="play-file" data="directory/dir-to_make_new_search.wav"/>
+ <action function="play-file" data="directory/dir-press.wav"/>
+ <action function="say" data="$4" method="pronounced" type="name_spelled"/>
+
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_say_name">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+ </match>
+ </input>
+ </macro>
+
+</include><!--This line will be ignored it's here to validate the xml and is optional -->
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/fr/dir/tts.xml
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/fr/dir/tts.xml (from rev 15313, freeswitch/trunk/conf/lang/fr/dir/tts.xml) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/fr/dir/tts.xml (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/fr/dir/tts.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,101 @@
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+
+ <macro name="directory_intro">
+ <input pattern="^(last_name)" break_on_match="false">
+ <match>
+ <action function="speak-text" data="Veuillez entrer les premiere lettre du nom de famille"/>
+ </match>
+ </input>
+ <input pattern="^(first_name)" break_on_match="false">
+ <match>
+ <action function="speak-text" data="Veuillez entrer les premiere lettre du prénom"/>
+ </match>
+ </input>
+ <input pattern="^(last_name):([0-9#*])$" break_on_match="false">
+ <match>
+ <action function="speak-text" data="pour chercher par prénom, appuyer sur le $2"/>
+ </match>
+ </input>
+ <input pattern="^(first_name):([0-9#*])$" break_on_match="false">
+ <match>
+ <action function="speak-text" data="pour chercher par nom de famille, appuyer sur le $2"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_min_search_digits">
+ <input pattern="^(1)$">
+ <match>
+ <action function="speak-text" data="Vous devez entré au minimum une lettre du nom de la personne, essayer de nouveaux"/>
+ </match>
+ </input>
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="Vous devez entré au minimum $1 lettre du nom de la personne, essayer de nouveaux"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_count">
+ <input pattern="^0$" break_on_match="true">
+ <match>
+ <action function="speak-text" data="Votre recherche a retourner aucune résultat, essayer de nouveaux"/>
+ </match>
+ </input>
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="$1 résultats correspond a votre recherche"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_count_too_large">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="Votre recherche retourne trop de résultat, essayer de nouveaux."/>
+ </match>
+ </input>
+
+ </macro>
+
+ <macro name="directory_result_last">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="Fin des résultats."/>
+ </match>
+ </input>
+
+ </macro>
+
+ <macro name="directory_result_item">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="Résultat numéro $1"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_menu">
+ <input pattern="^([0-9#*]),([0-9#*]),([0-9#*]),([0-9#*])$">
+ <match>
+ <action function="speak-text" data="Pour selectionner ce nom appuyer sur le $1, pour le nom suivant appuyer sur le $2, pour le nom précédent appuyer sur le $3 ou pour faire une nouvelle recherche appuyer sur le $4"/>
+ </match>
+ </input>
+ </macro>
+
+ <macro name="directory_result_at">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="aux poste $1"/>
+ </match>
+ </input>
+ </macro>
+ <macro name="directory_result_say_name">
+ <input pattern="^(.*)$">
+ <match>
+ <action function="speak-text" data="$1"/>
+ </match>
+ </input>
+ </macro>
+
+</include><!--This line will be ignored it's here to validate the xml and is optional -->
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/fr/fr.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/fr/fr.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/lang/fr/fr.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -2,6 +2,7 @@
<language name="fr" sound-path="/snds" tts-engine="cepstral" tts-voice="david">
<X-PRE-PROCESS cmd="include" data="demo/demo.xml"/>
<!--voicemail_fr_tts is purely implemented with tts, we need a files based implementation too -->
- <X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/>
+ <X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/>
+ <X-PRE-PROCESS cmd="include" data="dir/sounds.xml"/> <!-- dir/tts.xml if you want to use tts and have cepstral -->
</language>
</include>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/sip_profiles/internal.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/sip_profiles/internal.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/conf/sip_profiles/internal.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -75,7 +75,8 @@
<param name="local-network-acl" value="localnet.auto"/>
<!--<param name="apply-register-acl" value="domains"/>-->
<!--<param name="dtmf-type" value="info"/>-->
- <param name="record-template" value="$${base_dir}/recordings/${caller_id_number}.${target_domain}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
+ <param name="record-path" value="$${base_dir}/recordings"/>
+ <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"/>
<!--<param name="manage-shared-appearance" value="true"/>-->
@@ -159,12 +160,16 @@
<param name="inbound-reg-force-matching-username" value="true"/>
<!-- on authed calls, authenticate *all* the packets not just invite -->
<param name="auth-all-packets" value="false"/>
- <!--
- Possible options for ext-rtp-ip or ext-sip-ip
-
- auto - Use guessed ip.
- auto-nat - Use ip learned from NAT-PMP or UPNP
- -->
+
+ <!-- external_sip_ip
+ Used as the public IP address for SDP.
+ Can be an one of:
+ ip address - "12.34.56.78"
+ a stun server lookup - "stun:stun.server.com"
+ a DNS name - "host:host.server.com"
+ auto - Use guessed ip.
+ auto-nat - Use ip learned from NAT-PMP or UPNP
+ -->
<param name="ext-rtp-ip" value="auto-nat"/>
<param name="ext-sip-ip" value="auto-nat"/>
@@ -225,6 +230,9 @@
<!-- set to false disable this feature -->
<!--<param name="rtp-autofix-timing" value="false"/>-->
+ <!-- set this param to false if your gateway for some reason hates X- headers that it is supposed to ignore-->
+ <!--<param name="pass-callee-id" value="false"/>-->
+
<!-- clear clears them all or supply the name to add or the name prefixed with ~ to remove
valid values:
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/configure.in (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/configure.in 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/configure.in 2009-11-02 10:10:22 UTC (rev 15314)
@@ -826,7 +826,6 @@
AC_CONFIG_SUBDIRS(libs/pcre)
AC_CONFIG_SUBDIRS(libs/apr)
AC_CONFIG_SUBDIRS(libs/apr-util)
-AC_CONFIG_SUBDIRS(libs/voipcodecs)
AC_CONFIG_SUBDIRS(libs/ilbc)
AC_CONFIG_SUBDIRS(libs/curl)
AC_CONFIG_SUBDIRS(libs/iksemel)
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/DelphiWorld/dialplan/recording.xml (from rev 15313, freeswitch/trunk/contrib/DelphiWorld/dialplan/recording.xml) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/DelphiWorld/dialplan/recording.xml (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/DelphiWorld/dialplan/recording.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,18 @@
+<!-- recording / playback extension -->
+<!-- thank to rupa for the help -->
+<include>
+<extension name="recording">
+ <condition field="destination_number" expression="^(2020)$">
+<action application="answer"/>
+<action application="set" data="playback_terminators=#"/>
+<action application="record" data="/tmp/recorded.wav 20 200"/>
+ </condition>
+</extension>
+<extension name="playback">
+ <condition field="destination_number" expression="^(2021)$">
+<action application="answer"/>
+<action application="set" data="playback_terminators=#"/>
+<action application="playback" data="/tmp/recorded.wav"/>
+ </condition>
+</extension>
+</include>
\ No newline at end of file
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/cparker/mod_xml_radius/mod_xml_radius.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/cparker/mod_xml_radius/mod_xml_radius.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/cparker/mod_xml_radius/mod_xml_radius.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -157,7 +157,7 @@
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
@@ -188,7 +188,7 @@
switch_xml_t xml_in_tmp = NULL;
int i;
- if (switch_strlen_zero(xml_out->name)) {
+ if (zstr(xml_out->name)) {
xml_out->name = strdup(xml_in->name);
} else if (!(xml_out = switch_xml_add_child_d(xml_out, xml_in->name, *off++))) {
return SWITCH_STATUS_FALSE;
@@ -540,7 +540,7 @@
binding->bindings = strdup(bname);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML RADIUS Fetch Function [%s]\n",
- switch_strlen_zero(bname) ? "N/A" : bname, binding->bindings ? binding->bindings : "all");
+ zstr(bname) ? "N/A" : bname, binding->bindings ? binding->bindings : "all");
switch_xml_bind_search_function(xml_radius_search, switch_xml_parse_section_string(bname), binding);
binding = NULL;
}
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/callcard/README.md
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/callcard/TODO
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr (from rev 15313, freeswitch/trunk/contrib/diegoviola/ruby/cdr)
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr/cdr.rb
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr/cdr.rb (from rev 15313, freeswitch/trunk/contrib/diegoviola/ruby/cdr/cdr.rb) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr/cdr.rb (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr/cdr.rb 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+
+require 'rubygems'
+require 'fsr'
+require 'fsr/listener/inbound'
+require 'database.rb'
+
+def custom_channel_hangup_handler(event)
+ DB[:cdr].insert(
+ :caller_caller_id_name => event.content[:caller_caller_id_name],
+ :caller_caller_id_number => event.content[:caller_caller_id_number],
+ :caller_destination_number => event.content[:caller_destination_number],
+ :caller_context => event.content[:caller_context],
+ :variable_start_stamp => event.content[:variable_start_stamp],
+ :variable_answer_stamp => event.content[:variable_answer_stamp],
+ :variable_end_stamp => event.content[:variable_end_stamp],
+ :variable_duration => event.content[:variable_duration],
+ :variable_billsec => event.content[:variable_billsec],
+ :variable_hangup_cause => event.content[:variable_hangup_cause],
+ :unique_id => event.content[:unique_id],
+ :core_uuid => event.content[:core_uuid],
+ :variable_accountcode => event.content[:variable_accountcode],
+ :channel_read_codec_name => event.content[:channel_read_codec_name],
+ :variable_write_codec => event.content[:variable_write_codec])
+end
+
+FSL::Inbound.add_event_hook(:CHANNEL_HANGUP_COMPLETE) {|event| custom_channel_hangup_handler(event) }
+
+FSR.start_ies!(FSL::Inbound, :host => "localhost", :port => 8021)
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr/create_table.rb
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr/create_table.rb (from rev 15313, freeswitch/trunk/contrib/diegoviola/ruby/cdr/create_table.rb) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr/create_table.rb (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr/create_table.rb 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+
+require 'rubygems'
+require 'database.rb'
+
+DB.create_table :cdr do
+ primary_key :id
+ String :caller_caller_id_name
+ String :caller_caller_id_number
+ String :caller_destination_number
+ String :caller_context
+ String :variable_start_stamp
+ String :variable_answer_stamp
+ String :variable_end_stamp
+ String :variable_duration
+ String :variable_billsec
+ String :variable_hangup_cause
+ String :unique_id
+ String :core_uuid
+ String :variable_accountcode
+ String :channel_read_codec_name
+ String :variable_write_codec
+end
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr/database.rb
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr/database.rb (from rev 15313, freeswitch/trunk/contrib/diegoviola/ruby/cdr/database.rb) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr/database.rb (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/cdr/database.rb 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,3 @@
+require 'sequel'
+
+DB = Sequel.connect('mysql://root@localhost/freeswitch')
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/prepaid (from rev 15313, freeswitch/trunk/contrib/diegoviola/ruby/prepaid)
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/prepaid/server.rb
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/prepaid/server.rb (from rev 15313, freeswitch/trunk/contrib/diegoviola/ruby/prepaid/server.rb) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/prepaid/server.rb (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/diegoviola/ruby/prepaid/server.rb 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,40 @@
+#!/usr/bin/env ruby
+
+require 'rubygems'
+require 'fsr'
+require 'fsr/listener/inbound'
+require 'fsr/listener/outbound'
+require 'sequel'
+
+DB = Sequel.connect('mysql://root@localhost/freeswitch')
+
+class Rate < Sequel::Model
+end
+
+module Prepaid
+ def update_balance
+ @@timer = EM::PeriodicTimer.new(1){ puts "hello world" }
+ end
+end
+
+class Inbound < FSL::Inbound
+ include Prepaid
+
+ add_event_hook(:CHANNEL_HANGUP) {|event| custom_channel_hangup_handler(event) }
+ def self.custom_channel_hangup_handler(event)
+ @@timer.cancel
+ end
+end
+
+class Outbound < FSR::Listener::Outbound
+ include Prepaid
+
+ def session_initiated
+ update_balance
+ end
+end
+
+EM.run do
+ EM.connect "0.0.0.0", 8021, Inbound
+ EM.start_server "0.0.0.0", 8084, Outbound
+end
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -191,22 +191,22 @@
/* Set defaults for any variables still not set */
setdefaults:
- if (switch_strlen_zero(globals.db_username)) {
+ if (zstr(globals.db_username)) {
set_global_db_username("bandwidth.com");
}
- if (switch_strlen_zero(globals.db_password)) {
+ if (zstr(globals.db_password)) {
set_global_db_password("dev");
}
- if (switch_strlen_zero(globals.db_dsn)) {
+ if (zstr(globals.db_dsn)) {
set_global_db_dsn("bandwidth.com");
}
- if (switch_strlen_zero(globals.percall_action)) {
+ if (zstr(globals.percall_action)) {
set_global_percall_action("hangup");
}
- if (switch_strlen_zero(globals.lowbal_action)) {
+ if (zstr(globals.lowbal_action)) {
set_global_lowbal_action("play ding");
}
- if (switch_strlen_zero(globals.nobal_action)) {
+ if (zstr(globals.nobal_action)) {
set_global_nobal_action("hangup");
}
@@ -719,7 +719,7 @@
char *lbuf = NULL;
char *argv[3] = { 0 };
- if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
+ if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
if (!strcasecmp(argv[0], "adjust") && argc == 2) {
nibblebill_adjust(session, atof(argv[1]));
@@ -748,9 +748,9 @@
char *mycmd = NULL, *argv[3] = { 0 };
int argc = 0;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
- if ((argc == 2 || argc == 3) && !switch_strlen_zero(argv[0])) {
+ if ((argc == 2 || argc == 3) && !zstr(argv[0])) {
char *uuid = argv[0];
if ((psession = switch_core_session_locate(uuid))) {
switch_channel_t *channel;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/esl2agi/esl2agi.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/esl2agi/esl2agi.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/esl2agi/esl2agi.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -37,6 +37,22 @@
#include "esl2agi.h"
+static command_binding_t bindings[_MAX_CMD] = {
+ { {"ANSWER" , NULL}, handle_answer },
+ { {"HANGUP" , NULL}, handle_hangup },
+ { {"STREAM", "FILE" , NULL}, handle_streamfile },
+ { {"SET", "CALLERID" , NULL}, handle_set_caller_id },
+ { {"SET", "VARIABLE" , NULL}, handle_set_variable },
+ { {"EXEC", NULL}, handle_exec },
+ { {"GET", "DATA", NULL}, handle_getdata },
+};
+
+static command_binding_t exec_bindings[_MAX_CMD] = {
+ { {"DIAL" , NULL}, handle_dial },
+ { {"SET" , NULL}, handle_set_variable },
+ { {"SIPADDHEADER",NULL}, handle_sipaddheader },
+};
+
/*
* Translator thread entry point
*/
@@ -47,7 +63,7 @@
esl_handle_t eslC = {{0}};
char script_path[1024] = "\0";
- const char *buf;
+ char *buf;
int pid;
int thread_running;
@@ -94,6 +110,7 @@
close(pipes.socket[1]);
close(pipes.script[0]);
close(esl_req.client_sock);
+ close(STDERR_FILENO);
dup2(pipes.socket[0], STDIN_FILENO);
dup2(pipes.script[1], STDOUT_FILENO);
@@ -114,19 +131,16 @@
signal(SIGCHLD, SIG_IGN);
signal(SIGPIPE, SIG_IGN);
-
+ // fprintf(stderr,"New call, handling setup...\n");
handle_setup_env(pipes.socket[1],&eslC);
/* TODO: check status */
status = esl_send(&eslC,"myevents");
- eslC.async_execute = 0;
+ eslC.async_execute = 1;
while ( eslC.connected && thread_running) {
int r , nfds = 0;
fd_set rd;
- /* As we are in sync mode, we should NOT care about socket there,
- * there is a binding of esl_execute to find command results
- */
FD_ZERO(&rd);
FD_SET(pipes.script[0], &rd);
nfds = MAX(nfds,pipes.script[0]);
@@ -135,7 +149,6 @@
if (r == -1 )
break;
else if (FD_ISSET(pipes.script[0],&rd) ) { /* AGI has something to say */
- bzero(&sbuf,2047);
r = read(pipes.script[0],&sbuf,2047);
if (r<0)
goto end;
@@ -182,8 +195,7 @@
* Copyright (c) 2009, Anthony Minessale II
* TODO: - add mod_dialplan_asterisk lookup and load if not present.
*/
-int main(int argc, char *argv[])
-{
+int main(int argc, char *argv[]) {
int i;
char *ip = NULL;
int port = 0;
@@ -199,7 +211,7 @@
}
if (!(ip && port)) {
- fprintf(stderr, "Usage %s -h <host> -p <port>\n", argv[0]);
+ // fprintf(stderr, "Usage %s -h <host> -p <port>\n", argv[0]);
return -1;
}
@@ -210,175 +222,134 @@
return 0;
}
+static int safe_int_snprintf_buffer(char **buf,const char *format, int ret) {
+ int size;
+ size = 2 + strlen(format); // Max 2 digits in int
+ if (*buf != NULL)
+ *buf = realloc(*buf,size+1);
+ else
+ *buf = malloc(size +1);
+ memset(*buf,0,size+1);
+ size = snprintf(*buf,size+1,format,ret);
+ return size;
+}
+
+/*
+ * Return malloc'd buf containing header value specified with %format
+ */
+static int fill_buffer_from_header(esl_event_t *event,char **buf,char *header,const char *format) {
+ int size=0;
+ char *sbuf;
+ sbuf = esl_event_get_header(event, header);
+ if (sbuf) {
+ size = strlen(sbuf) + strlen(format);
+ if (*buf == NULL)
+ *buf = malloc(size+1);
+ else
+ *buf = realloc(*buf,size+1);
+ memset(*buf,0,size+1);
+ size = snprintf(*buf,size,format,sbuf);
+ }
+ return size;
+}
+
/* Setup env
- * TODO: - correct parameters
- * - add a generic routine instead of blindly repeating code
+ * TODO: - check size, if no header found we should not block
*/
static int handle_setup_env(int fd,esl_handle_t *eslC) {
- char buf[1024];
- char *sbuf;
+ char *sbuf=NULL;
+ int size;
/* Setup Env for AGI scripts */
- if ( (sbuf = esl_event_get_header(eslC->info_event, "variable_ivr_path")) ) {
- sprintf(buf,"agi_request: %s\n",sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
+ if ( (size = fill_buffer_from_header(eslC->info_event,&sbuf,"variable_ivr_path","agi_request: %s\n") ) > 0) {
+ if ( write(fd,sbuf,size) < 0)
return -1;
}
else
- return -1;
+ return -1;
- if ( (sbuf = esl_event_get_header(eslC->info_event, "variable_channel_name")) ) {
- sprintf(buf,"agi_channel: %s\n",sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
+ if ( (size = fill_buffer_from_header(eslC->info_event,&sbuf,"variable_channel_name","agi_channel: %s\n") ) > 0) {
+ if ( write(fd,sbuf,size) < 0)
return -1;
}
else
- return -1;
+ return -1;
- if ( write(fd, "agi_language: en\n",18) < 0 )
+ if ( write(fd, "agi_language: en\n",strlen("agi_language: en\n") ) < 0 )
return -1;
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Channel-Source")) ) {
- sprintf(buf, "agi_type: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
+ if ( (size = fill_buffer_from_header(eslC->info_event,&sbuf,"Channel-Source","agi_type: %s\n") ) > 0) {
+ if ( write(fd,sbuf,size) < 0)
return -1;
}
else
- return -1;
+ return -1;
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Channel-Unique-ID")) ) {
- sprintf(buf, "agi_uniqueid: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
+ if ( (size = fill_buffer_from_header(eslC->info_event,&sbuf,"Channel-Unique-ID","agi_uniqueid: %s\n") ) > 0) {
+ if ( write(fd,sbuf,size) < 0)
return -1;
}
else
- return -1;
+ return -1;
- /* ANI/DNIS */
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Channel-Caller-ID-Number")) ) {
- sprintf(buf, "agi_callerid: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
+ if ( (size = fill_buffer_from_header(eslC->info_event,&sbuf,"Channel-Caller-ID-Number","agi_callerid: %s\n") ) > 0) {
+ if ( write(fd,sbuf,size) < 0)
return -1;
}
- else {
- sprintf(buf, "agi_callerid: %s\n", "unknown");
- if ( write(fd, buf,strlen(buf) ) < 0)
+ else
return -1;
- }
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Channel-Caller-ID-Name")) ) {
- sprintf(buf, "agi_calleridname: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
+
+ if ( (size = fill_buffer_from_header(eslC->info_event,&sbuf,"Channel-Caller-ID-Name","agi_calleridname: %s\n") ) > 0) {
+ if ( write(fd,sbuf,size) < 0)
return -1;
}
- else {
- sprintf(buf, "agi_calleridname: %s\n", "unknown");
- if ( write(fd, buf,strlen(buf) ) < 0)
+ else
return -1;
- }
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Channel-Screen-Bit")) ) {
- sprintf(buf, "agi_callingpres: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
+ if ( (size = fill_buffer_from_header(eslC->info_event,&sbuf,"Channel-Screen-Bit","agi_callingpres: %s\n") ) > 0) {
+ if ( write(fd,sbuf,size) < 0)
return -1;
}
- else {
- sprintf(buf, "agi_callingpres: %s\n", "unknown");
- if ( write(fd, buf,strlen(buf) ) < 0)
+ else
return -1;
- }
- /* TODO */
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Caller-Caller-ID-Number")) ) {
- sprintf(buf, "agi_callingani2: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
- return -1;
- }
- else {
- sprintf(buf, "agi_callingani2: %s\n", "unknown");
- if ( write(fd, buf,strlen(buf) ) < 0)
- return -1;
- }
- /* TODO */
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Caller-Caller-ID-Number")) ) {
- sprintf(buf, "agi_callington: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
- return -1;
- }
- else {
- sprintf(buf, "agi_callington: %s\n", "unknown");
- if ( write(fd, buf,strlen(buf) ) < 0)
- return -1;
- }
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Caller-Destination-Number")) ) {
- sprintf(buf, "agi_dnid: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
- return -1;
- }
- else {
- sprintf(buf, "agi_dnid: %s\n", "unknown");
- if ( write(fd, buf,strlen(buf) ) < 0)
- return -1;
- }
- /* TODO */
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Caller-Destination-Number")) ) {
- sprintf(buf, "agi_callingtns: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
- return -1;
- }
- else {
- sprintf(buf, "agi_callingtns: %s\n", "unknown");
- if ( write(fd, buf,strlen(buf) ) < 0)
- return -1;
- }
- /* TODO: correct info */
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Caller-Destination-Number")) ) {
- sprintf(buf, "agi_rdnis: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
+ if ( (size = fill_buffer_from_header(eslC->info_event,&sbuf,"Caller-Destination-Number","agi_dnid: %s\n") ) > 0) {
+ if ( write(fd,sbuf,size) < 0)
return -1;
}
- else {
- sprintf(buf, "agi_rdnis: %s\n", "unknown");
- if ( write(fd, buf,strlen(buf) ) < 0)
+ else
return -1;
- }
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Channel-Context")) ) {
- sprintf(buf, "agi_context: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
- return -1;
- }
- else {
- sprintf(buf, "agi_context: %s\n", "unknown");
- if ( write(fd, buf,strlen(buf) ) < 0)
- return -1;
- }
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Channel-Destination-Number")) ) {
- sprintf(buf, "agi_extension: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
+ if ( (size = fill_buffer_from_header(eslC->info_event,&sbuf,"Channel-Context","agi_context: %s\n") ) > 0) {
+ if ( write(fd,sbuf,size) < 0)
return -1;
}
- else {
- sprintf(buf, "agi_extension: %s\n", "unknown");
- if ( write(fd, buf,strlen(buf) ) < 0)
+ else
return -1;
- }
- /* TODO: correct info */
- if ( (sbuf = esl_event_get_header(eslC->info_event, "Channel-State-Number")) ) {
- sprintf(buf, "agi_priority: %s\n", sbuf);
- if ( write(fd, buf,strlen(buf) ) < 0)
+ if ( (size = fill_buffer_from_header(eslC->info_event,&sbuf,"Channel-Destination-Number","agi_extension: %s\n") ) > 0) {
+ if ( write(fd,sbuf,size) < 0)
return -1;
}
- else {
- sprintf(buf, "agi_priority: %s\n", "unknown");
- if ( write(fd, buf,strlen(buf) ) < 0)
+ else
return -1;
- }
- if ( write(fd, "agi_enhanced: 0.0\n", 19) < 0 )
+ /* TODO
+ * agi_callingani2
+ * agi_callington
+ * agi_callingtns
+ * agi_rdnis
+ * agi_priority
+ */
+
+ if ( write(fd, "agi_enhanced: 0.0\n", strlen("agi_enhanced: 0.0\n") ) < 0 )
return -1;
- if ( write(fd, "agi_accountcode: \n\n", 21) < 0 )
+ if ( write(fd, "agi_accountcode: \n", strlen("agi_accountcode: \n") ) < 0 )
return -1;
+
+ if ( write(fd, "\n\n", 2 ) < 0 )
+ return -1;
+
return 0;
}
@@ -393,7 +364,7 @@
if ( esl_execute(eslC,cmd,args,uuid) != ESL_FAIL) {
while (!done && eslC->connected) {
if (esl_recv_event(eslC,1,NULL) == ESL_FAIL)
- return -1;
+ return -1; // Maybe point of failure
else if (eslC->last_ievent) {
if (eslC->last_ievent->event_id == ESL_EVENT_CHANNEL_EXECUTE_COMPLETE ) {
if (! strcasecmp(cmd,esl_event_get_header(eslC->last_ievent,"Application") ) )
@@ -410,91 +381,297 @@
}
/*
+ * Answer AGI cmd
+ * TODO: Why is there an A on the AGI side ?
+ */
+static int handle_answer(esl_handle_t *eslC,int fd,int *argc, char *argv[]) {
+ int res;
+ int size;
+ char *buf=NULL;
+ res = do_execute(eslC,"answer",NULL,NULL,NULL);
+
+ size = safe_int_snprintf_buffer(&buf,"200 result=%d\n\n",res);
+
+ res = write(fd,buf,size);
+ free(buf);
+ return res;
+}
+
+/*
+ * SIPADDHEADER(header=value)
+ * TODO: split on = and set the sip_h_header var
+ */
+static int handle_sipaddheader(esl_handle_t *eslC,int fd,int *argc, char *argv[]) {
+ int res;
+ int size;
+ char *buf=NULL;
+
+ res = -1;
+ size = safe_int_snprintf_buffer(&buf,"200 result=%d\n\n",res);
+
+ res = write(fd,buf,size);
+ free(buf);
+ return res;
+}
+
+/*
* Hangup AGI cmd
* TODO: - Add arg support to know which channel we want to hangup.
*/
static int handle_hangup(esl_handle_t *eslC,int fd,int *argc, char *argv[]) {
- if (do_execute(eslC,"hangup",NULL,NULL,NULL) < 0 ) {
- if ( write(fd,"200 result=-1\n\n",128) < 0 )
- return -1;
+ int res;
+ int size;
+ char *buf=NULL;
+
+ res = do_execute(eslC,"hangup",NULL,NULL,NULL);
+
+ size = safe_int_snprintf_buffer(&buf,"200 result=%d\n\n",res);
+
+ res = write(fd,buf,size);
+ free(buf);
+ return res;
+}
+
+/*
+ * EXEC command, will search exec_bindings for an entry.
+ */
+static int handle_exec(esl_handle_t *eslC,int fd,int *argc, char *args[]) {
+ int res;
+ int i;
+ char *argv[_MAX_CMD_ARGS];
+
+ for (i = 1;i<=*argc;i++)
+ argv[i-1] = args[i];
+
+ res = find_and_exec_app(eslC,fd,*argc, argv);
+
+ return res;
+}
+
+/*
+ * SET CALLERID
+ */
+static int handle_set_caller_id(esl_handle_t *eslC,int fd,int *argc, char *argv[]) {
+ int res;
+ int size;
+ char *buf=NULL;
+
+ if (*argc < 3 && *argc > 4) {
+ res = -1;
+ goto end;
}
+
+ if (argv[2]) {
+ size = strlen(argv[2]) + 30;
+ buf = malloc(size + 1);
+ snprintf(buf,size +1 ,"origination_caller_id_number=%s",argv[2]);
+ }
else {
- if ( write(fd,"200 result=0\n\n",128) < 0 )
- return -1;
+ res = -1;
+ goto end;
}
+
+ res = do_execute(eslC,"set",buf,NULL,NULL);
+
+end:
+ size = safe_int_snprintf_buffer(&buf,"200 result=%d\n\n",res);
+
+ res = write(fd,buf,size);
+ free(buf);
+ return res;
+}
+
+/*
+ * DIAL command
+ * TODO: implement heh
+ * DIAL string is SIP/endpoint/user|timeout|options|url
+ * we should write our own binding as mod_dialplan_asterisk does not seem to support options
+ */
+static int handle_dial(esl_handle_t *eslC,int fd,int *argc, char *argv[]) {
return 0;
}
/*
- * Answer AGI cmd
+ * SET VARIABLE
+ * TODO: - verify support for exec('SET','var=value').
+ - add support for exec('SET','FUNC(param)=value')
*/
-static int handle_answer(esl_handle_t *eslC,int fd,int *argc, char *argv[]) {
- if (do_execute(eslC,"answer",NULL,NULL,NULL) < 0 ) {
- if ( write(fd,"200 result=-1\n\n",128) < 0 )
- return -1;
+static int handle_set_variable(esl_handle_t *eslC,int fd,int *argc, char *argv[]) {
+ int res;
+ int size;
+ char *buf=NULL;
+
+ if (*argc < 2 && *argc > 3) { /* SET VARIABLE var value or SET var=value */
+ res = -1;
+ goto end;
}
+
+ if ( (strstr("=",argv[1])) != NULL ) { /* Support for exec set var=value*/
+ if (strstr("(",argv[1]) != NULL && strstr(")",argv[1]) != NULL ) {
+ /* TODO implement * func(param)=value */
+ res = -1;
+ goto end;
+ }
+ else {
+ size = strlen(argv[1]);
+ buf = malloc(size + 1);
+ snprintf(buf,size+1,"%s",argv[1]);
+ }
+ }
+ else if (argv[2] && argv[3]) {
+ size = strlen(argv[2]) + strlen(argv[3]) + 1;
+ buf = malloc(size + 1);
+ snprintf(buf,size +1 ,"%s=%s",argv[2],argv[3]);
+ }
else {
- if ( write(fd,"200 result=0\n\n",128) < 0 )
- return -1;
+ res = -1;
+ goto end;
}
- return 0;
+
+ res = do_execute(eslC,"set",buf,NULL,NULL);
+end:
+ size = safe_int_snprintf_buffer(&buf,"200 result=%d\n\n",res);
+
+ res = write(fd,buf,size);
+ free(buf);
+ return res;
}
+/*
+ * GET DATA filetoplay timeout maxdigits
+ * will execute the play_and_get_digits app ( <min> <max> <tries> <timeout> <terminators> <file> <invalid_file> <var_name> <regexp> )
+ */
+
+static int handle_getdata(esl_handle_t *eslC,int fd,int *argc, char *argv[]) {
+ char *buf;
+ char *args;
+ int res=0;
+ int size;
+ esl_event_t *reply=NULL;
+
+ if (*argc > 5 && *argc < 3 ) {
+ res = -1;
+ goto end;
+ }
+
+ args = malloc(1024);
+ snprintf(args,1024,"1 %s 1 %s # %s invalid.wav play_get_digits_values \\d+",argv[4] ? argv[4] : "9999", argv[3] ? argv[3] : "2000", argv[2]);
+
+ if (do_execute(eslC,"play_and_get_digits",args,NULL,&reply) < 0 ) {
+ res = -1;
+ goto end;
+ }
+ else {
+ if (reply) {
+ res = fill_buffer_from_header(reply,&args,"variable_play_get_digits_values","%s");
+ }
+ else {
+ res = -1;
+ goto end;
+ }
+
+ }
+
+end:
+ if (args)
+ free(args);
+ if (res < 0) {
+ size = safe_int_snprintf_buffer(&buf,"200 result=%d\n\n",res);
+ }
+ else {
+ size = strlen(args) + 10;
+ buf = malloc(size + 1);
+ snprintf(buf,size + 1,"200 result=%s",args);
+ }
+
+ res = write(fd,buf,size);
+ free(buf);
+
+ return res;
+}
+
+/*
+ * STREAM FILE agi cmd
+ */
static int handle_streamfile(esl_handle_t *eslC,int fd,int *argc, char *argv[]) {
- char buf[1024];
- char *sbuf;
+ char *buf;
int offset=0;
- int dtmf=0;
+ char dtmf[2]={"0"};
+ int res;
+
esl_event_t *reply=NULL;
- if (*argc < 3 || *argc > 5)
- return -1;
-
- if (argv[3]) {
+ if (*argc < 3 || *argc > 5) {
+ offset=-1;
+ goto end;
+ }
+
+ if (argv[3] && strncasecmp("\"\"",argv[3],2) ) {
/* We should set playback_terminators var there */
- sprintf(buf,"playback_terminators=%s",argv[3]);
+ buf = malloc(strlen(argv[3])+22);
+ memset(buf,0,strlen(argv[3])+22);
+ snprintf(buf,22,"playback_terminators=%s",argv[3]);
do_execute(eslC,"set",buf,NULL,NULL);
+ free(buf);
}
- bzero(&buf,1023);
if (argv[4]) {
offset = atoi(argv[4]);
}
- if (offset > 0)
- sprintf(buf,"%s@@%d",argv[2],offset);
+ buf = malloc(strlen(argv[2]) + 1);
+ memset(buf,0,strlen(argv[2])+1);
+
+ if (offset > 0) {
+ buf = realloc(buf,strlen(argv[2]) + strlen(argv[4]) + 3);
+ snprintf(buf,strlen(argv[2]) + strlen(argv[4]) + 3,"%s@@%d",argv[2],offset);
+
+ }
else
- sprintf(buf,"%s",argv[2]);
+ snprintf(buf,strlen(argv[2]) + 1,"%s",argv[2]);
+
offset = 0;
- if ( do_execute(eslC,"playback",buf,NULL,&reply) < 0 ) /* We should write about NON success there instead of returning stock */
- return -1;
+ if ( do_execute(eslC,"playback",buf,NULL,&reply) < 0 ) { /* We should write about NON success there instead of returning stock */
+ offset = -1;
+ }
else {
- bzero(&buf,1023);
- /* We should check playback_samples var to return offset, sent in the CHANNEL_EXECUTE_COMPLETE and
- variable_playback_terminator_used to get the DTMF we had */
+ free(buf);
+ buf=NULL;
if (reply) {
- if (! (sbuf = esl_event_get_header(reply, "variable_playback_samples")) )
- offset = -1;
- else {
- offset = atoi(sbuf);
- }
- if (! (sbuf = esl_event_get_header(reply, "variable_playback_terminator_used")) )
- dtmf = 0;
- else {
- dtmf = atoi(sbuf);
- }
+ res = fill_buffer_from_header(reply,&buf,"variable_playback_samples","%s");
+ if ( res <= 0 )
+ offset = 0;
+ else
+ offset = atoi(buf);
+
+ res = fill_buffer_from_header(reply,&buf,"variable_playback_terminator_used","%s");
+ // sbuf = esl_event_get_header(reply, "variable_playback_terminator_used");
+ if (res > 0)
+ snprintf((char *)&dtmf,2,"%s",buf);
}
+ else {
+ offset=-1;
+ }
}
+ if (buf != NULL)
+ free(buf);
+
+end:
if (offset < 0) {
- if ( write(fd,"200 result=-1 endpos=0\n\n",128) < 0 )
+ if ( write(fd,"200 result=-1 endpos=0\n\n",128) < 0 ) {
return -1;
+ }
}
else {
- sprintf(buf,"200 result=%d endpos=%d\n\n",dtmf,offset);
- if ( write(fd,buf,128) < 0 )
+ buf=malloc(65);
+ memset(buf,0,65);
+ snprintf(buf,64,"200 result=%s endpos=%d\n\n",dtmf,offset);
+ if ( write(fd,buf,64) < 0 ) {
+ free(buf);
return -1;
+ }
+ free(buf);
}
-
return 0;
}
@@ -550,13 +727,6 @@
return;
}
-static command_binding_t bindings[_MAX_CMD] = {
- { {"ANSWER" , NULL}, handle_answer },
- { {"HANGUP" , NULL}, handle_hangup },
- { {"STREAM", "FILE" , NULL}, handle_streamfile },
-};
-
-
static command_binding_t *find_binding(char *cmd[]) {
int x,y,match=0;
@@ -580,6 +750,29 @@
return NULL;
}
+static command_binding_t *find_app_binding(char *cmd[]) {
+ int x,y,match=0;
+
+ for (x=0; x < sizeof(exec_bindings); x++) {
+ if ( ! exec_bindings[x].cmd[0] ) {
+ break;
+ }
+ match = 1;
+
+ for (y=0; match && cmd[y]; y++) {
+ if (!exec_bindings[x].cmd[y]) /* Is the next part existing ?*/
+ break;
+ if ( strncasecmp(exec_bindings[x].cmd[y],cmd[y], MAX(strlen(exec_bindings[x].cmd[y]),strlen(cmd[y]) ) ) )
+ match=0;
+ }
+ if (exec_bindings[x].cmd[y]) /* There's a word missing in cmd */
+ match=0;
+ if (match)
+ return &exec_bindings[x];
+ }
+ return NULL;
+}
+
static int find_and_exec_command(esl_handle_t *eslC,int fd,char *buf) {
char *argv[1024];
int argc = 0;
@@ -595,3 +788,13 @@
return r;
}
+static int find_and_exec_app(esl_handle_t *eslC,int fd,int argc,char *argv[]) {
+ int r = -1;
+ command_binding_t *bind;
+
+ bind = find_app_binding(argv);
+ if (bind) {
+ r = bind->handler(eslC,fd,&argc,argv);
+ }
+ return r;
+}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/esl2agi/esl2agi.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/esl2agi/esl2agi.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/esl2agi/esl2agi.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -61,6 +61,7 @@
#define ESL_A_TO_VOID(v) ((void*)(v))
#define VOID_TO_ESL_A(p) ((esl_accept_t*)(p))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
+#define MIN(x,y) ((x) < (y) ? (x) : (y))
/*
* Struct Section
@@ -88,49 +89,53 @@
static void *esl2agi_thread(void *data);
-/*
- * - EXEC application OPTIONS
- * - GET DATA filetoplay timeout maxdigits
- * - GET VARIABLE variablename
- * - HANGUP 'channelname'
- * - RECORD FILE filename format escapedigits timeout offsetsamples BEEP s=silence
- * - SAY DIGITS
- * - set autohangup time
- * - set music on|off class
- * - set variable
- * - stream file filename <escape digits> [sample offset]
- * - wait for digit timeout
- */
-
static int handle_setup_env(int fd,esl_handle_t *eslC);
static void parse_args(char *buf,int *argc,char *argv[_MAX_CMD_ARGS]);
static command_binding_t *find_binding(char *cmd[]);
-static int handle_hangup(esl_handle_t *eslC,int fd,int *argc, char *argv[_MAX_CMD_ARGS]);
+static command_binding_t *find_app_binding(char *cmd[]);
-static int handle_answer(esl_handle_t *eslC,int fd, int *argc, char *argv[_MAX_CMD_ARGS]);
-
static int find_and_exec_command(esl_handle_t *eslC,int fd,char *buf);
+static int find_and_exec_app(esl_handle_t *eslC,int fd,int argc,char *argv[]);
+
+static int do_execute(esl_handle_t *eslC,char *cmd,char *args,char *uuid,esl_event_t **save_reply);
+
/*
+ * ported agi commands
+ */
+static int handle_hangup(esl_handle_t *eslC,int fd,int *argc, char *argv[_MAX_CMD_ARGS]);
-static int handle_exec(esl_handle_t *eslC,int fd,char *args);
+static int handle_answer(esl_handle_t *eslC,int fd, int *argc, char *argv[_MAX_CMD_ARGS]);
-static int handle_getdata(esl_handle_t *eslC,int fd,char *args);
+static int handle_streamfile(esl_handle_t *eslC,int fd,int *argc, char *argv[_MAX_CMD_ARGS]);
-static int handle_getvar(esl_handle_t *eslC,int fd,char *args);
+static int handle_getdata(esl_handle_t *eslC,int fd,int *argc, char *argv[_MAX_CMD_ARGS]);
-static int handle_record(esl_handle_t *eslC,int fd,char *args);
+static int handle_set_caller_id(esl_handle_t *eslC,int fd,int *argc, char *argv[_MAX_CMD_ARGS]);
-static int handle_say(esl_handle_t *eslC,int fd,char *args);
+static int handle_set_variable(esl_handle_t *eslC,int fd,int *argc, char *argv[_MAX_CMD_ARGS]);
-static int handle_setvar(esl_handle_t *eslC,int fd,char *args);
+static int handle_exec(esl_handle_t *eslC,int fd,int *argc, char *argv[_MAX_CMD_ARGS]);
-static int handle_set(esl_handle_t *eslC,int fd,char *args);
+static int handle_dial(esl_handle_t *eslC,int fd,int *argc, char *argv[]);
-static int handle_streamfile(esl_handle_t *eslC,int fd,char *args);
+static int handle_sipaddheader(esl_handle_t *eslC,int fd,int *argc, char *argv[]);
-static int handle_waitdigits(esl_handle_t *eslC,int fd,char *args);
-*/
+/* TODO
+ * - ANSWER : OK
+ * - EXEC application OPTIONS: OK, now will need to add more bindings
+ * - GET DATA filetoplay timeout maxdigits
+ * - GET VARIABLE variablename
+ * - HANGUP 'channelname' : TODO channel name to hangup
+ * - RECORD FILE filename format escapedigits timeout offsetsamples BEEP s=silence
+ * - SAY DIGITS
+ * - set autohangup time
+ * - set music on|off class
+ * - set variable: should be OK ( untested )
+ * - set callerid: should be OK ( untested )
+ * - stream file filename <escape digits> [sample offset] : OK ( check when using offset todo )
+ * - wait for digit timeout
+ */
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/check.php (from rev 15313, freeswitch/trunk/contrib/gled/php/check.php) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/check.php (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/check.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,18 @@
+#!/usr/bin/php -q
+<?php
+require_once('phpagi-2.14/phpagi.php');
+
+$agi = new AGI();
+logthis("New call incoming");
+
+$agi->answer();
+
+logthis("Answered");
+
+$res = $agi->stream_file('/telephony/freeswitch/sounds/en/us/callie/ivr/8000/ivr-you_have_dialed_an_invalid_extension.wav',"*");
+
+logthis("Stream_file res:".print_r($res,true));
+
+$agi->hangup();
+
+?>
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14 (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14)
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/COPYING
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/COPYING (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/COPYING) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/COPYING (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/COPYING 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,458 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/README
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/README (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/README) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/README (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/README 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,52 @@
+PHPAGI README
+ $Id: README,v 1.4 2005/05/19 13:19:37 pinhole Exp $
+---------------------------------------
+
+Welcome to PHPAGI.
+
+phpagi is a set of PHP classes for use in developing applications with
+the Asterisk Gateway Interface, and is licensed under the GNU Lesser
+General Public License (see COPYING for terms).
+
+This release (version 2) of the phpagi classes is a significant overhaul
+from the old version 1 library. API functions have been renamed and
+restructured.
+
+Version 1 of phpagi is no longer supported, but will continue to be
+available for historical purposes. We strongly encourage you to migrate
+to this new version.
+
+If you have developed software based around phpagi, we'd like to hear from
+you! Drop us a note, and indicate whether you'd like us to list your
+application on our website.
+
+FILES
+-----
+ phpagi.php - The main phpagi class.
+ phpagi-asmanager.php - The Asterisk Manager class.
+ phpagi-fastagi.php - FastAGI class.
+ phpagi_1.php - Compatability class for 1.12 release
+
+ docs/ - README files for the classes.
+ api-docs/ - API Documentation (html)
+
+DOCS
+----
+ README.phpagi - The main phpagi README
+ README.phpagi-asmanager - The phpagi asterisk manager README
+ README.phpagi-fastagi - phpagi fastagi README
+
+ CHANGELOG - Change Log.
+
+ phpagi.conf - An example configuration file for phpagi.
+ fastagi.xinetd - xinetd.conf sample configuration for fastagi
+
+
+SUPPORT
+-------
+
+Support for phpagi is available from the project website.
+
+ * http://phpagi.sourceforge.net
+ * http://sourceforge.net/projects/phpagi/
+
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/docs)
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CHANGELOG
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CHANGELOG (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/docs/CHANGELOG) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CHANGELOG (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CHANGELOG 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,159 @@
+----------
+CHANGES
+----------
+
+May 25, 2005 - David Eder
+ * Added fastpass support.
+
+May 18, 2005 - David Eder
+ * Added phpagi_1.php as a wrapper class for 1.12 compatibility.
+
+March 25, 2005 - David Eder
+ * Changed the way text2wave and swift are executed for better compatibility.
+ * Added caching to text2wav and swift.
+
+March 12, 2005 - David Eder
+ * fixed autohangup in phpagi-asmanager.php, renamed to set_autohangup.
+ * Added more documentation to phpagi-asmanager.php.
+ * Added weather example.
+
+March 4, 2005 - David Eder
+ * FastAGI via xinetd
+
+February 17, 2005 - David Eder
+ * Fixed bugs with error handler.
+
+February 16, 2005 - David Eder
+ * Added Cepstral swift TTS patch from C. Arbusti of Soluzioni Vocali ( http://soluzionivocali.it ).
+ * Extended swift TTS functionality.
+ * Moved tempdir from [festival] to [phpagi] so that it can be shared with other extensions.
+
+February 2, 2005 - David Eder
+ * More documentation.
+ * Reworked and reintegrated AGI_AsteriskManager class.
+
+January 21, 2005 - David Eder
+ * Added exec_dial($type, $identifier, $timeout=NULL, $options=NULL, $url=NULL).
+ * Added exec_goto($a, $b=NULL, $c=NULL).
+ * Fixed bugs in evaluate, better support of multiline and closed input and output.
+ * Fixed bugs in config initialization.
+
+January 19, 2005 - David Eder
+ * SUMMARY:
+ * Massive restructuring!
+ * Updated to use more PHP internal functions.
+ * Updated function arguments to represent their AGI function's arguments.
+ * Functions now return a consistent result array.
+ * Added phpdoc documentation.
+ * Removed functions that can be done with internal PHP or AGI functions.
+ * Enhanced error handler.
+ *
+ * Goals of changes:
+ *
+ * It is important for a language API to not wander too far from the general
+ * API. Functions that are named differently have been updated. Function
+ * arguments that do not match the AGI API have been updated. Underscores
+ * have been substituted for spaces to make them compatible with PHP function
+ * names. Optional arguments in AGI should remain optional if possible. Return
+ * values should be consistent. Functions need to be better documented.
+ *
+ * Result:
+ *
+ * The return from most functions is now
+ * array('code'=>$code, 'result'=>$result, 'data'=>$data)
+ * ['data'] still needs some work.
+ *
+ * removed class variables:
+ * $response - It was no longer used with the new return structure.
+ *
+ * removed functions:
+ * agi_is_error($retarr) - It was no longer used with the new return
+ * structure. Each function has it's own result that must be evalutated
+ * by the programmer, as the return values are often specific to the function.
+ * agi_readresult($str=FALSE) - It was no longer used with the new return structure.
+ * agi_response_code() - It was no longer used with the new return structure.
+ * agi_response_result() - It was no longer used with the new return structure.
+ * agi_response_data() - It was no longer used with the new return structure.
+ * agi_response_var($var) - It was no longer used with the new return structure.
+ * agi_response_is_error() - see agi_is_error
+ * agi_read() - It was deprecated
+ * con_print_r($arr,$label='',$lvl=0) - Use print_r($arr, true) in conjunction with conlog
+ * agi_getdtmf($len,$timeout,$terminator=FALSE,$prompt=FALSE) - use get_data
+ * agi_dtmf2text($len,$timeout,$terminator=FALSE,$prompt=FALSE) - use text_input
+ * arr2str($arr) - use PHP function join
+ * config_load($file) - use PHP function parse_ini_file
+ * enum_lookup($telnumber,$rDNS="e164.org") - use exec_enumlookup
+ * enum_txtlookup($telnumber,$rDNS="e164.org") - use exec_enumlookup
+ *
+ * added functions:
+ * answer()
+ * autohangup($time=0)
+ * exec($application, $options)
+ * get_data($filename, $timeout=NULL, $max_digits=NULL)
+ * receive_char($timeout=-1)
+ * say_phonetic($text, $escape_digits='')
+ * set_context($context)
+ * set_extension($extension)
+ * set_priority($priority)
+ * tdd_mode($setting)
+ * wait_for_digit($timeout=-1)
+ * database_deltree($family, $keytree='')
+ * noop()
+ * set_music($enabled=true, $class='')
+ * exec_absolutetimeout($seconds=0)
+ * exec_agi($command, $args)
+ * exec_enumlookup($exten)
+ * text_input($mode='NUMERIC')
+ * say_punctuation($text, $escape_digits='', $frequency=8000)
+ * which($cmd, $checkpath=NULL)
+ * make_folder($folder, $perms=0755)
+ * updated functions:
+ * agi_exec($str) -> evaluate($command) - exec is an AGI function
+ * agi_verbose($str,$vbl=1) -> verbose($message, $level=1) - consistency with AGI
+ * db_get($family,$key) -> database_get($family, $key) - consistency with AGI
+ * db_put($family,$key,$val) -> database_put($family, $key, $value) - consistency with AGI
+ * db_del($family,$key) -> database_del($family, $key) - consistency with AGI
+ * get_var($var) -> get_variable($variable) - consistency with AGI
+ * set_var($var,$val) -> set_variable($variable, $value) - consistency with AGI
+ * agi_hangup() -> hangup($channel='') - consistency with AGI
+ * agi_channel_status($channel) -> channel_status($channel='') - consistency with AGI
+ * agi_recordfile($file,$format,$timeout=5000,$prompt=FALSE) -> record_file($file, $format, $escape_digits='', $timeout=-1, $beep=false, $silence=NULL) - consistency with AGI
+ * agi_play($file) -> stream_file($filename, $escape_digits='', $offset=0) - consistency with AGI
+ * agi_goto($con,$ext='s',$pri=1) -> goto($context, $extension='s', $priority=1) - consistency with AGI
+ * agi_saydigits($digits) -> say_digits($digits, $escape_digits='') - consistency with AGI
+ * agi_saynumber($number) -> say_number($number, $escape_digits='') - consistency with AGI
+ * agi_saytime($time="") -> say_time($time=NULL, $escape_digits='') - consistency with AGI
+ * agi_setlanguage($language="en") -> exec_setlanguage($language='en') - consistency with AGI
+ * text2wav($text) -> text2wav($text, $escape_digits='', $frequency=8000) - consistency with AGI
+ * phpagi_error_handler($errno, $errstr, $errfile, $errline) -> phpagi_error_handler($level, $message, $file, $line, $context) - I needed better error handling
+
+August 29, 2004 -
+ * Fixed db_get now returns a value
+ * Fixed db_put now stores a value
+ * Added enum_lookup, requires external "dig" utility.
+ * Tweak con_print_r now dumps arrays, displays variable type.
+ * Added enum_txtlookup, requires external "dig" utility".
+ * Added parse_callerid, thanks to http://www.sbuehl.com/projects/asterisk/asterisk-howto-3.html
+
+August 26, 2004 -
+ * Added agi_verbose
+ * Added debug config-option to shut conlog up
+ * Added agi_saydigits, agi_saynumber, agi_saytime, agi_setlanguage
+
+April 8, 2004 - v1.5 internal
+ * Added agi_goto - David Croft
+ * Added this changelog (maintain it eh?) - Matthew Asham
+ * Added quote fixing to conlog - David Croft
+ * Added new parameter to AGI constructor, $configopt array - Matthew Asham
+ - Added phpagi_error_handler - David Croft
+
+
+
+March 20, 2004 - v1.5
+ * Fixed buffering bugs - David Croft
+ * added demo app. - Matthew Asham
+ * misc stuff. - Matthew Asham
+
+November 2003
+ * Initial version
+
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/docs/CVS)
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS/Entries
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS/Entries (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/docs/CVS/Entries) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS/Entries (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS/Entries 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,7 @@
+/CHANGELOG/1.4/Wed May 25 18:43:57 2005//
+/README.phpagi/1.1/Mon Mar 14 19:38:20 2005//
+/README.phpagi-asmanager/1.1/Mon Mar 14 19:38:20 2005//
+/README.phpagi-fastagi/1.1/Mon Mar 14 19:38:20 2005//
+/fastagi.xinetd/1.1/Mon Mar 14 19:38:20 2005//
+/phpagi.example.conf/1.1/Mon Mar 14 19:38:20 2005//
+D
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS/Repository
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS/Repository (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/docs/CVS/Repository) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS/Repository (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS/Repository 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1 @@
+phpagi/docs
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS/Root
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS/Root (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/docs/CVS/Root) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS/Root (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/CVS/Root 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1 @@
+:ext:masham@cvs.sourceforge.net:/cvsroot/phpagi
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/README.phpagi
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/README.phpagi (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/docs/README.phpagi) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/README.phpagi (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/README.phpagi 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,94 @@
+phpagi: an AGI class written in PHP
+
+ Matthew Asham <matthewa@bcwireless.net>
+ http://phpagi.sourceforge.net
+
+Contributions by:
+ Florian Overkamp <florian@speakup.nl>
+ David Eder <david@eder.us>
+
+OVERVIEW
+--------
+
+Include it:
+
+require 'phpagi.php';
+
+Construct it:
+
+$agi = new AGI();
+
+This creates a new AGI object with all the agi vars read in, you're now ready
+to rock and roll.
+
+Answer the line.
+
+$agi->answer();
+
+Play a file.
+
+$agi->stream_file('somefile.gsm');
+
+Record a file.
+
+$agi->record_file($file, $format, $escape_digits='', $timeout=-1, $beep=false, $silence=NULL)
+
+There's more, read the class or refer to the PHPAGI website for more information.
+
+ This README is seriousley lacking.
+
+CONFIGURATION
+-------------
+
+phpagi supports an ini style configuration file, and run time configuration.
+
+By default the class reads in the contents of /etc/asterisk/phpagi.conf into
+$this->config. The format of the ini file is as follows:
+
+[examplesection]
+foo=bar
+bar=dew
+dew=pale ale
+
+This is read into $this->config as:
+
+$this->config['examplesection']['foo']='bar';
+$this->config['examplesection']['bar]='dew';
+$this->config['examplesection']['dew']='pale ale';
+
+
+Run time configuration is also supported. Pass an array of variables and values as the
+second parameter to the AGI constructor, these fields are stored in $this->config['phpagi'].
+
+ie:
+
+$myconfig=array(
+ "error_handler"="true"
+);
+
+ $agi=new AGI("/etc/asterisk/phpagi.conf",$myconfig);
+
+
+The following run-time configuration options are used by the phpagi class to change behaviour. They
+are all contained in the $this->config['phpagi'] array.
+
+ * error_handler - set to "true" (string) to enable php debugging
+
+
+EXAMPLE APPLICATION
+-------------------
+
+ping.php is an example phpagi application. it asks for an IP address to be
+entered, and reads back the results of a "ping" summary.
+
+to use it, you'll need festival installed. see http://www.voip-info.org/tiki-index.php?page=Asterisk+festival+installation
+for all the groovy bits to get festival working with asterisk, then configure
+phpagi to use it too:
+
+in /etc/asterisk/phpagi.conf:
+
+[festival]
+text2wave=/usr/src/festival/bin/text2wave
+tempdir=/var/lib/asterisk/sounds/tmp/
+
+
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/README.phpagi-asmanager
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/README.phpagi-asmanager (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/docs/README.phpagi-asmanager) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/README.phpagi-asmanager (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/README.phpagi-asmanager 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,218 @@
+phpagi-asmanager: an Asterisk Manager class written in PHP
+
+ Matthew Asham <matthewa@bcwireless.net>
+ http://phpagi.sourceforge.net
+------------------------------------------------------------------------------
+
+------------------------------------------------------------------------------
+SECURITY
+------------------------------------------------------------------------------
+
+Validation:
+
+******If asterisk is running as root, the manager interface may allow the
+execution of arbitrary shell commands as root. If the user can update any
+configuration file that can execute arbitrary command (like the dialplan),
+the system may be compromised.
+
+Also, look out for command injection. Consider the following example:
+
+ $as->Events($_POST['events_status']);
+
+We expect either 'on' or 'off', but the attacker uses:
+
+ "\r\n\r\nAction: Command\r\nCommand: database put forward 54321 19005551212";
+
+
+Validation is a *must* for all user data.
+
+
+Username and Secret:
+
+Storing the username and secret in the config file will isolate them from your
+code.
+
+Isolation of username and secret in the config file does not mean that the
+script cannot simple read the config file. The config file must be readable
+by the script.
+
+
+CREATING A NEW INSTANCE OF THE CLASS
+------------------------------------------------------------------------------
+
+The class can be created standalone of phpagi.php, or through phpagi.
+
+STANDALONE:
+
+require "phpagi-asmanager.php";
+
+$as = new AGI_AsteriskManager();
+
+FROM PHPAGI:
+
+require "phpagi.php";
+
+$agi = new AGI();
+$as = $agi->new_AsteriskManager();
+
+Notes:
+
+* If the class is created using $agi->new_AsteriskManager(),
+ AGI_AsteriskManager will use the parent phpagi for logging to the Asterisk
+ console.
+
+* phpagi.php will include phpagi-asmanager.php by itself.
+ * If phpagi-asmanager.php is included _before_ phpagi.php, phpagi.php will
+ not attempt to re-include it.
+ * If phpagi.php tries to include phpagi-asmanager.php but is unable to do
+ so, an error will be echoed to the asterisk console and the script will
+ continue running normally. in this case the return value of
+ new_AsteriskManager() will be FALSE.
+
+------------------------------------------------------------------------------
+CONFIGURATION
+------------------------------------------------------------------------------
+
+phpagi-asmanager uses the same configuration file as phpagi.conf (usually
+/etc/asterisk/phpagi.conf). All configuration information specific to
+phpagi-asmanager is contained in the [asmanager] section of the .conf file.
+
+supported directives:
+
+[asmanager]
+# server to connect to
+server=localhost
+
+# default manager port
+port=5038
+
+#username for login
+username=me_and_only_me
+
+#password for login
+secret=i_am_not_telling
+
+
+
+------------------------------------------------------------------------------
+CONNECTING
+------------------------------------------------------------------------------
+
+ $res = $as->connect("localhost", "username", "password");
+ if($res == FALSE) {
+ echo "Connection failed.\n";
+ }
+ elseif($res == TRUE){
+ echo "Connection established.\n";
+ }
+
+A port can also be specified for the hostname. eg:
+
+ $res = $as->connect("my.asterisk.server:1234", "username", "port");
+
+If the no parameters are specified, the defaults from the config will be used.
+
+
+------------------------------------------------------------------------------
+DISCONNECTING
+------------------------------------------------------------------------------
+
+ $as->disconnect();
+
+------------------------------------------------------------------------------
+SENDING REQUESTS
+------------------------------------------------------------------------------
+
+ $as->send_request($eventname, $arrayofparameterstopass);
+
+send_request() calls wait_request and returns an array of returned data from
+the manager. If something went wrong, it returns false.
+
+wait_request() shouldn't need to be called from a script directly unless you
+are implementing merely an event listener.
+
+wait_request() will also detect events and dispatch any registered event
+handlers for the event.
+
+examples:
+
+ $res = $as->send_request('EventName',
+ array('Channel'=>'Zap/1/16045551212',
+ 'SomeParameter'=>'data'));
+ echo "Dump of returned data:\n";
+ foreach($res as $var=>$val)
+ echo "$var = $val\n";
+
+
+$res['Response'] will generally be 'Success' on success and 'Error' on
+failure. But this is not always true. If $res['Response'] == 'Follows', a
+multi-line response will be stored in $res['data'].
+
+Several manager commands have been aliased for convenience. See below.
+
+------------------------------------------------------------------------------
+EVENTS
+------------------------------------------------------------------------------
+
+TODO: non-blocking socket i/o.
+
+The class uses event callbacks to process events received from the manager.
+
+The event callback prototype looks like:
+
+ function dump_event($ecode, $data, $server, $port)
+ {
+ echo "received event '$ecode' from $server:$port\n";
+ print_r($data);
+ }
+
+To register an event call back:
+
+ $as->add_event_handler('eventname', 'eventfunction');
+
+eg:
+
+ $as->add_event_handler('registry', 'dump_event');
+
+
+The special eventname "*" can also be registered. any eventname not
+specifically registered will be handled by the "*" handler. If no "*" handler
+is defined, the event will be silently ignored.
+
+
+------------------------------------------------------------------------------
+PRECANNED FUNCTIONS
+------------------------------------------------------------------------------
+
+The following Manager functions have been aliased for convenience:
+
+AbsoluteTimeout
+ChangeMonitor
+Command
+Events
+ExtensionState
+GetVar
+Hangup
+IAXPeers
+ListCommands
+Logoff
+MailboxCount
+MailboxStatus
+Monitor
+Originate
+ParkedCalls
+Ping
+Queues
+QueueStatus
+Redirect
+SetCDRUserField
+SetVar
+SIPpeers
+Status
+StopMontor
+ZapDialOffhook
+ZapDNDoff
+ZapDNDon
+ZapHangup
+ZapTransfer
+
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/README.phpagi-fastagi
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/README.phpagi-fastagi (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/docs/README.phpagi-fastagi) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/README.phpagi-fastagi (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/README.phpagi-fastagi 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,46 @@
+First, in /etc/services, at this line:
+
+fastagi 4573/tcp # Asterisk AGI
+
+
+
+Second, create /etc/xnetd.d/fastagi with:
+
+# default: off
+# description: fastagi is a remote AGI interface
+service fastagi
+{
+ socket_type = stream
+ user = root
+ group = nobody
+ server = <path to phpagi-fastagi.php>
+ wait = no
+ protocol = tcp
+ bind = 127.0.0.1
+ disable = no
+}
+
+Make sure you set the path to the phpagi-fastagi.php script. Set the user
+and group to a non-root user if none of your scripts need root access. You
+might consider using posix_setuid and friends to reduce privileges. Change
+the bind address to your outbound IP address or to 0.0.0.0 to allow anyone
+to connect. Be sure to read up about xinetd and take advantage of security
+features it provides. Fast AGI doesn't provide authentification. It's up
+to you to keep unwanted visitors from extracting information from your AGI
+implementation.
+
+
+Third, write your code.
+
+Take special notice of how fastagi.php works:
+
+ 1. $fastagi is initialized as a new AGI.
+ 2. The script determines which script was requested.
+ 3. The script is called using
+ reqire_once($fastagi->request['agi_request']).
+ 4. Your script takes over. You must not create a new AGI, but
+ insead use the $fastagi instance that has already been created.
+
+In your dialplan:
+
+exten => 5551212, 1, Agi(agi://127.0.0.1/myscript.php)
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/fastagi.xinetd
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/fastagi.xinetd (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/docs/fastagi.xinetd) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/fastagi.xinetd (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/fastagi.xinetd 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,14 @@
+# default: off
+# description: fastagi is a remote AGI interface
+service fastagi
+{
+ socket_type = stream
+ user = root
+ group = nobody
+ server = /var/lib/asterisk/agi-bin/phpagi/phpagi-fastagi.php
+ wait = no
+ protocol = tcp
+ bind = 127.0.0.1
+ disable = no
+}
+
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/phpagi.example.conf
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/phpagi.example.conf (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/docs/phpagi.example.conf) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/phpagi.example.conf (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/docs/phpagi.example.conf 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,26 @@
+; example phpagi.conf
+
+[phpagi]
+debug=true ; enable debuging
+error_handler=true ; use internal error handler
+admin=errors@mydomain.com ; mail errors to
+hostname=sip.mydomain.com ; host name of this server
+tempdir=/var/spool/asterisk/tmp/ ; temporary directory for storing temporary output
+
+[asmanager]
+server=localhost ; server to connect to
+port=5038 ; default manager port
+username=me_and_only_me ; username for login
+secret=i_am_not_telling ; password for login
+
+[fastagi]
+setuid=true ; drop privileges to owner of script
+basedir=/var/lib/asterisk/agi-bin/ ; path to script folder
+
+[festival] ; text to speech engine
+text2wave=/usr/bin/text2wave ; path to text2wave binary
+
+[cepstral] ; alternate text to speech engine
+swift=/opt/swift/bin/swift ; path to switft binary
+voice=David ; default voice
+
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/mkdocs.php
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/mkdocs.php (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/mkdocs.php) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/mkdocs.php (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/mkdocs.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,7 @@
+#!/usr/local/bin/php -q
+<?php
+ $cwd = getcwd();
+ passthru("phpdoc -t \"$cwd/api-docs\" -f \"$cwd/phpagi.php,$cwd/phpagi-asmanager.php,$cwd/phpagi-fastagi.php,$cwd/phpagi_1.php\" -pp on -ti \"phpAGI\" -o HTML:frames:earthli -s on");
+?>
+
+
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/phpagi-asmanager.php
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/phpagi-asmanager.php (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/phpagi-asmanager.php) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/phpagi-asmanager.php (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/phpagi-asmanager.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,818 @@
+<?php
+ /**
+ * phpagi-asmanager.php : PHP Asterisk Manager functions
+ * Website: http://phpagi.sourceforge.net
+ *
+ * $Id: phpagi-asmanager.php,v 1.10 2005/05/25 18:43:48 pinhole Exp $
+ *
+ * Copyright (c) 2004, 2005 Matthew Asham <matthewa@bcwireless.net>, David Eder <david@eder.us>
+ * All Rights Reserved.
+ *
+ * This software is released under the terms of the GNU Lesser General Public License v2.1
+ * A copy of which is available from http://www.gnu.org/copyleft/lesser.html
+ *
+ * We would be happy to list your phpagi based application on the phpagi
+ * website. Drop me an Email if you'd like us to list your program.
+ *
+ * @package phpAGI
+ * @version 2.0
+ */
+
+
+ /**
+ * Written for PHP 4.3.4, should work with older PHP 4.x versions.
+ * Please submit bug reports, patches, etc to http://sourceforge.net/projects/phpagi/
+ * Gracias. :)
+ *
+ */
+
+ if(!class_exists('AGI'))
+ {
+ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'phpagi.php');
+ }
+
+ /**
+ * Asterisk Manager class
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+config+manager.conf
+ * @link http://www.voip-info.org/wiki-Asterisk+manager+API
+ * @example examples/sip_show_peer.php Get information about a sip peer
+ * @package phpAGI
+ */
+ class AGI_AsteriskManager
+ {
+ /**
+ * Config variables
+ *
+ * @var array
+ * @access public
+ */
+ var $config;
+
+ /**
+ * Socket
+ *
+ * @access public
+ */
+ var $socket = NULL;
+
+ /**
+ * Server we are connected to
+ *
+ * @access public
+ * @var string
+ */
+ var $server;
+
+ /**
+ * Port on the server we are connected to
+ *
+ * @access public
+ * @var integer
+ */
+ var $port;
+
+ /**
+ * Parent AGI
+ *
+ * @access private
+ * @var AGI
+ */
+ var $pagi;
+
+ /**
+ * Event Handlers
+ *
+ * @access private
+ * @var array
+ */
+ var $event_handlers;
+
+ /**
+ * Constructor
+ *
+ * @param string $config is the name of the config file to parse or a parent agi from which to read the config
+ * @param array $optconfig is an array of configuration vars and vals, stuffed into $this->config['asmanager']
+ */
+ function AGI_AsteriskManager($config=NULL, $optconfig=array())
+ {
+ // load config
+ if(!is_null($config) && file_exists($config))
+ $this->config = parse_ini_file($config, true);
+ elseif(file_exists(DEFAULT_PHPAGI_CONFIG))
+ $this->config = parse_ini_file(DEFAULT_PHPAGI_CONFIG, true);
+
+ // If optconfig is specified, stuff vals and vars into 'asmanager' config array.
+ foreach($optconfig as $var=>$val)
+ $this->config['asmanager'][$var] = $val;
+
+ // add default values to config for uninitialized values
+ if(!isset($this->config['asmanager']['server'])) $this->config['asmanager']['server'] = 'localhost';
+ if(!isset($this->config['asmanager']['port'])) $this->config['asmanager']['port'] = 5038;
+ if(!isset($this->config['asmanager']['username'])) $this->config['asmanager']['username'] = 'placecalls';
+ if(!isset($this->config['asmanager']['secret'])) $this->config['asmanager']['secret'] = 'asecret';
+ }
+
+ /**
+ * Send a request
+ *
+ * @param string $action
+ * @param array $parameters
+ * @return array of parameters
+ */
+ function send_request($action, $parameters=array())
+ {
+ $req = "Action: $action\r\n";
+ foreach($parameters as $var=>$val)
+ $req .= "$var: $val\r\n";
+ $req .= "\r\n";
+ fwrite($this->socket, $req);
+ return $this->wait_response();
+ }
+
+ /**
+ * Wait for a response
+ *
+ * If a request was just sent, this will return the response.
+ * Otherwise, it will loop forever, handling events.
+ *
+ * @param boolean $allow_timeout if the socket times out, return an empty array
+ * @return array of parameters, empty on timeout
+ */
+ function wait_response($allow_timeout=false)
+ {
+ $timeout = false;
+ do
+ {
+ $type = NULL;
+ $parameters = array();
+
+ $buffer = trim(fgets($this->socket, 4096));
+ while($buffer != '')
+ {
+ $a = strpos($buffer, ':');
+ if($a)
+ {
+ if(!count($parameters)) // first line in a response?
+ {
+ $type = strtolower(substr($buffer, 0, $a));
+ if(substr($buffer, $a + 2) == 'Follows')
+ {
+ // A follows response means there is a miltiline field that follows.
+ $parameters['data'] = '';
+ $buff = fgets($this->socket, 4096);
+ while(substr($buff, 0, 6) != '--END ')
+ {
+ $parameters['data'] .= $buff;
+ $buff = fgets($this->socket, 4096);
+ }
+ }
+ }
+
+ // store parameter in $parameters
+ $parameters[substr($buffer, 0, $a)] = substr($buffer, $a + 2);
+ }
+ $buffer = trim(fgets($this->socket, 4096));
+ }
+
+ // process response
+ switch($type)
+ {
+ case '': // timeout occured
+ $timeout = $allow_timeout;
+ break;
+ case 'event':
+ $this->process_event($parameters);
+ break;
+ case 'response':
+ break;
+ default:
+ $this->log('Unhandled response packet from Manager: ' . print_r($parameters, true));
+ break;
+ }
+ } while($type != 'response' && !$timeout);
+ return $parameters;
+ }
+
+ /**
+ * Connect to Asterisk
+ *
+ * @example examples/sip_show_peer.php Get information about a sip peer
+ *
+ * @param string $server
+ * @param string $username
+ * @param string $secret
+ * @return boolean true on success
+ */
+ function connect($server=NULL, $username=NULL, $secret=NULL)
+ {
+ // use config if not specified
+ if(is_null($server)) $server = $this->config['asmanager']['server'];
+ if(is_null($username)) $username = $this->config['asmanager']['username'];
+ if(is_null($secret)) $secret = $this->config['asmanager']['secret'];
+
+ // get port from server if specified
+ if(strpos($server, ':') !== false)
+ {
+ $c = explode(':', $server);
+ $this->server = $c[0];
+ $this->port = $c[1];
+ }
+ else
+ {
+ $this->server = $server;
+ $this->port = $this->config['asmanager']['port'];
+ }
+
+ // connect the socket
+ $errno = $errstr = NULL;
+ $this->socket = @fsockopen($this->server, $this->port, $errno, $errstr);
+ if($this->socket == false)
+ {
+ $this->log("Unable to connect to manager {$this->server}:{$this->port} ($errno): $errstr");
+ return false;
+ }
+
+ // read the header
+ $str = fgets($this->socket);
+ if($str == false)
+ {
+ // a problem.
+ $this->log("Asterisk Manager header not received.");
+ return false;
+ }
+ else
+ {
+ // note: don't $this->log($str) until someone looks to see why it mangles the logging
+ }
+
+ // login
+ $res = $this->send_request('login', array('Username'=>$username, 'Secret'=>$secret, 'Events' => 'off'));
+ if($res['Response'] != 'Success')
+ {
+ $this->log("Failed to login.");
+ $this->disconnect();
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Disconnect
+ *
+ * @example examples/sip_show_peer.php Get information about a sip peer
+ */
+ function disconnect()
+ {
+ $this->logoff();
+ fclose($this->socket);
+ }
+
+ // *********************************************************************************************************
+ // ** COMMANDS **
+ // *********************************************************************************************************
+
+ /**
+ * Set Absolute Timeout
+ *
+ * Hangup a channel after a certain time.
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+AbsoluteTimeout
+ * @param string $channel Channel name to hangup
+ * @param integer $timeout Maximum duration of the call (sec)
+ */
+ function AbsoluteTimeout($channel, $timeout)
+ {
+ return $this->send_request('AbsoluteTimeout', array('Channel'=>$channel, 'Timeout'=>$timeout));
+ }
+
+ /**
+ * Change monitoring filename of a channel
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ChangeMonitor
+ * @param string $channel the channel to record.
+ * @param string $file the new name of the file created in the monitor spool directory.
+ */
+ function ChangeMonitor($channel, $file)
+ {
+ return $this->send_request('ChangeMontior', array('Channel'=>$channel, 'File'=>$file));
+ }
+
+ /**
+ * Execute Command
+ *
+ * @example examples/sip_show_peer.php Get information about a sip peer
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Command
+ * @link http://www.voip-info.org/wiki-Asterisk+CLI
+ * @param string $command
+ * @param string $actionid message matching variable
+ */
+ function Command($command, $actionid=NULL)
+ {
+ $parameters = array('Command'=>$command);
+ if($actionid) $parameters['ActionID'] = $actionid;
+ return $this->send_request('Command', $parameters);
+ }
+
+ /**
+ * Enable/Disable sending of events to this manager
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Events
+ * @param string $eventmask is either 'on', 'off', or 'system,call,log'
+ */
+ function Events($eventmask)
+ {
+ return $this->send_request('Events', array('EventMask'=>$eventmask));
+ }
+
+ /**
+ * Check Extension Status
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ExtensionState
+ * @param string $exten Extension to check state on
+ * @param string $context Context for extension
+ * @param string $actionid message matching variable
+ */
+ function ExtensionState($exten, $context, $actionid=NULL)
+ {
+ $parameters = array('Exten'=>$exten, 'Context'=>$context);
+ if($actionid) $parameters['ActionID'] = $actionid;
+ return $this->send_request('ExtensionState', $parameters);
+ }
+
+ /**
+ * Gets a Channel Variable
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+GetVar
+ * @link http://www.voip-info.org/wiki-Asterisk+variables
+ * @param string $channel Channel to read variable from
+ * @param string $variable
+ * @param string $actionid message matching variable
+ */
+ function GetVar($channel, $variable, $actionid=NULL)
+ {
+ $parameters = array('Channel'=>$channel, 'Variable'=>$variable);
+ if($actionid) $parameters['ActionID'] = $actionid;
+ return $this->send_request('GetVar', $parameters);
+ }
+
+ /**
+ * Hangup Channel
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Hangup
+ * @param string $channel The channel name to be hungup
+ */
+ function Hangup($channel)
+ {
+ return $this->send_request('Hangup', array('Channel'=>$channel));
+ }
+
+ /**
+ * List IAX Peers
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+IAXpeers
+ */
+ function IAXPeers()
+ {
+ return $this->send_request('IAXPeers');
+ }
+
+ /**
+ * List available manager commands
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ListCommands
+ * @param string $actionid message matching variable
+ */
+ function ListCommands($actionid=NULL)
+ {
+ if($actionid)
+ return $this->send_request('ListCommands', array('ActionID'=>$actionid));
+ else
+ return $this->send_request('ListCommands');
+ }
+
+ /**
+ * Logoff Manager
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Logoff
+ */
+ function Logoff()
+ {
+ return $this->send_request('Logoff');
+ }
+
+ /**
+ * Check Mailbox Message Count
+ *
+ * Returns number of new and old messages.
+ * Message: Mailbox Message Count
+ * Mailbox: <mailboxid>
+ * NewMessages: <count>
+ * OldMessages: <count>
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+MailboxCount
+ * @param string $mailbox Full mailbox ID <mailbox>@<vm-context>
+ * @param string $actionid message matching variable
+ */
+ function MailboxCount($mailbox, $actionid=NULL)
+ {
+ $parameters = array('Mailbox'=>$mailbox);
+ if($actionid) $parameters['ActionID'] = $actionid;
+ return $this->send_request('MailboxCount', $parameters);
+ }
+
+ /**
+ * Check Mailbox
+ *
+ * Returns number of messages.
+ * Message: Mailbox Status
+ * Mailbox: <mailboxid>
+ * Waiting: <count>
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+MailboxStatus
+ * @param string $mailbox Full mailbox ID <mailbox>@<vm-context>
+ * @param string $actionid message matching variable
+ */
+ function MailboxStatus($mailbox, $actionid=NULL)
+ {
+ $parameters = array('Mailbox'=>$mailbox);
+ if($actionid) $parameters['ActionID'] = $actionid;
+ return $this->send_request('MailboxStatus', $parameters);
+ }
+
+ /**
+ * Monitor a channel
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Monitor
+ * @param string $channel
+ * @param string $file
+ * @param string $format
+ * @param boolean $mix
+ */
+ function Monitor($channel, $file=NULL, $format=NULL, $mix=NULL)
+ {
+ $parameters = array('Channel'=>$channel);
+ if($file) $parameters['File'] = $file;
+ if($format) $parameters['Format'] = $format;
+ if(!is_null($file)) $parameters['Mix'] = ($mix) ? 'true' : 'false';
+ return $this->send_request('Monitor', $parameters);
+ }
+
+ /**
+ * Originate Call
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Originate
+ * @param string $channel Channel name to call
+ * @param string $exten Extension to use (requires 'Context' and 'Priority')
+ * @param string $context Context to use (requires 'Exten' and 'Priority')
+ * @param string $priority Priority to use (requires 'Exten' and 'Context')
+ * @param string $application Application to use
+ * @param string $data Data to use (requires 'Application')
+ * @param integer $timeout How long to wait for call to be answered (in ms)
+ * @param string $callerid Caller ID to be set on the outgoing channel
+ * @param string $variable Channel variable to set (VAR1=value1|VAR2=value2)
+ * @param string $account Account code
+ * @param boolean $async true fast origination
+ * @param string $actionid message matching variable
+ */
+ function Originate($channel,
+ $exten=NULL, $context=NULL, $priority=NULL,
+ $application=NULL, $data=NULL,
+ $timeout=NULL, $callerid=NULL, $variable=NULL, $account=NULL, $async=NULL, $actionid=NULL)
+ {
+ $parameters = array('Channel'=>$channel);
+
+ if($exten) $parameters['Exten'] = $exten;
+ if($context) $parameters['Context'] = $context;
+ if($priority) $parameters['Priority'] = $priority;
+
+ if($application) $parameters['Application'] = $application;
+ if($data) $parameters['Data'] = $data;
+
+ if($timeout) $parameters['Timeout'] = $timeout;
+ if($callerid) $parameters['CallerID'] = $callerid;
+ if($variable) $parameters['Variable'] = $variable;
+ if($account) $parameters['Account'] = $account;
+ if(!is_null($async)) $parameters['Async'] = ($async) ? 'true' : 'false';
+ if($actionid) $parameters['ActionID'] = $actionid;
+
+ return $this->send_request('Originate', $parameters);
+ }
+
+ /**
+ * List parked calls
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ParkedCalls
+ * @param string $actionid message matching variable
+ */
+ function ParkedCalls($actionid=NULL)
+ {
+ if($actionid)
+ return $this->send_request('ParkedCalls', array('ActionID'=>$actionid));
+ else
+ return $this->send_request('ParkedCalls');
+ }
+
+ /**
+ * Ping
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Ping
+ */
+ function Ping()
+ {
+ return $this->send_request('Ping');
+ }
+
+ /**
+ * Queue Add
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+QueueAdd
+ * @param string $queue
+ * @param string $interface
+ * @param integer $penalty
+ */
+ function QueueAdd($queue, $interface, $penalty=0)
+ {
+ $parameters = array('Queue'=>$queue, 'Interface'=>$interface);
+ if($penalty) $parameters['Penalty'] = $penalty;
+ return $this->send_request('QueueAdd', $parameters);
+ }
+
+ /**
+ * Queue Remove
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+QueueRemove
+ * @param string $queue
+ * @param string $interface
+ */
+ function QueueRemove($queue, $interface)
+ {
+ return $this->send_request('QueueRemove', array('Queue'=>$queue, 'Interface'=>$interface));
+ }
+
+ /**
+ * Queues
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Queues
+ */
+ function Queues()
+ {
+ return $this->send_request('Queues');
+ }
+
+ /**
+ * Queue Status
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+QueueStatus
+ * @param string $actionid message matching variable
+ */
+ function QueueStatus($actionid=NULL)
+ {
+ if($actionid)
+ return $this->send_request('QueueStatus', array('ActionID'=>$actionid));
+ else
+ return $this->send_request('QueueStatus');
+ }
+
+ /**
+ * Redirect
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Redirect
+ * @param string $channel
+ * @param string $extrachannel
+ * @param string $exten
+ * @param string $context
+ * @param string $priority
+ */
+ function Redirect($channel, $extrachannel, $exten, $context, $priority)
+ {
+ return $this->send_request('Redirect', array('Channel'=>$channel, 'ExtraChannel'=>$extrachannel, 'Exten'=>$exten,
+ 'Context'=>$context, 'Priority'=>$priority));
+ }
+
+ /**
+ * Set the CDR UserField
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+SetCDRUserField
+ * @param string $userfield
+ * @param string $channel
+ * @param string $append
+ */
+ function SetCDRUserField($userfield, $channel, $append=NULL)
+ {
+ $parameters = array('UserField'=>$userfield, 'Channel'=>$channel);
+ if($append) $parameters['Append'] = $append;
+ return $this->send_request('SetCDRUserField', $parameters);
+ }
+
+ /**
+ * Set Channel Variable
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+SetVar
+ * @param string $channel Channel to set variable for
+ * @param string $variable name
+ * @param string $value
+ */
+ function SetVar($channel, $variable, $value)
+ {
+ return $this->send_request('SetVar', array('Channel'=>$channel, 'Variable'=>$variable, 'Value'=>$value));
+ }
+
+ /**
+ * Channel Status
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Status
+ * @param string $channel
+ * @param string $actionid message matching variable
+ */
+ function Status($channel=NULL, $actionid=NULL)
+ {
+ if ($channel) {
+ $parameters = array('Channel'=>$channel);
+ }
+ else {
+ $parameters = array();
+ }
+ if($actionid) $parameters['ActionID'] = $actionid;
+ return $this->send_request('Status', $parameters);
+ }
+
+ /**
+ * Stop monitoring a channel
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+StopMonitor
+ * @param string $channel
+ */
+ function StopMontor($channel)
+ {
+ return $this->send_request('StopMonitor', array('Channel'=>$channel));
+ }
+
+ /**
+ * Dial over Zap channel while offhook
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapDialOffhook
+ * @param string $zapchannel
+ * @param string $number
+ */
+ function ZapDialOffhook($zapchannel, $number)
+ {
+ return $this->send_request('ZapDialOffhook', array('ZapChannel'=>$zapchannel, 'Number'=>$number));
+ }
+
+ /**
+ * Toggle Zap channel Do Not Disturb status OFF
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapDNDoff
+ * @param string $zapchannel
+ */
+ function ZapDNDoff($zapchannel)
+ {
+ return $this->send_request('ZapDNDoff', array('ZapChannel'=>$zapchannel));
+ }
+
+ /**
+ * Toggle Zap channel Do Not Disturb status ON
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapDNDon
+ * @param string $zapchannel
+ */
+ function ZapDNDon($zapchannel)
+ {
+ return $this->send_request('ZapDNDon', array('ZapChannel'=>$zapchannel));
+ }
+
+ /**
+ * Hangup Zap Channel
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapHangup
+ * @param string $zapchannel
+ */
+ function ZapHangup($zapchannel)
+ {
+ return $this->send_request('ZapHangup', array('ZapChannel'=>$zapchannel));
+ }
+
+ /**
+ * Transfer Zap Channel
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapTransfer
+ * @param string $zapchannel
+ */
+ function ZapTransfer($zapchannel)
+ {
+ return $this->send_request('ZapTransfer', array('ZapChannel'=>$zapchannel));
+ }
+
+ /**
+ * Zap Show Channels
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapShowChannels
+ * @param string $actionid message matching variable
+ */
+ function ZapShowChannels($actionid=NULL)
+ {
+ if($actionid)
+ return $this->send_request('ZapShowChannels', array('ActionID'=>$actionid));
+ else
+ return $this->send_request('ZapShowChannels');
+ }
+
+ // *********************************************************************************************************
+ // ** MISC **
+ // *********************************************************************************************************
+
+ /*
+ * Log a message
+ *
+ * @param string $message
+ * @param integer $level from 1 to 4
+ */
+ function log($message, $level=1)
+ {
+ if($this->pagi != false)
+ $this->pagi->conlog($message, $level);
+ else
+ error_log(date('r') . ' - ' . $message);
+ }
+
+ /**
+ * Add event handler
+ *
+ * Known Events include ( http://www.voip-info.org/wiki-asterisk+manager+events )
+ * Link - Fired when two voice channels are linked together and voice data exchange commences.
+ * Unlink - Fired when a link between two voice channels is discontinued, for example, just before call completion.
+ * Newexten -
+ * Hangup -
+ * Newchannel -
+ * Newstate -
+ * Reload - Fired when the "RELOAD" console command is executed.
+ * Shutdown -
+ * ExtensionStatus -
+ * Rename -
+ * Newcallerid -
+ * Alarm -
+ * AlarmClear -
+ * Agentcallbacklogoff -
+ * Agentcallbacklogin -
+ * Agentlogoff -
+ * MeetmeJoin -
+ * MessageWaiting -
+ * join -
+ * leave -
+ * AgentCalled -
+ * ParkedCall - Fired after ParkedCalls
+ * Cdr -
+ * ParkedCallsComplete -
+ * QueueParams -
+ * QueueMember -
+ * QueueStatusEnd -
+ * Status -
+ * StatusComplete -
+ * ZapShowChannels - Fired after ZapShowChannels
+ * ZapShowChannelsComplete -
+ *
+ * @param string $event type or * for default handler
+ * @param string $callback function
+ * @return boolean sucess
+ */
+ function add_event_handler($event, $callback)
+ {
+ $event = strtolower($event);
+ if(isset($this->event_handlers[$event]))
+ {
+ $this->log("$event handler is already defined, not over-writing.");
+ return false;
+ }
+ $this->event_handlers[$event] = $callback;
+ return true;
+ }
+
+ /**
+ * Process event
+ *
+ * @access private
+ * @param array $parameters
+ * @return mixed result of event handler or false if no handler was found
+ */
+ function process_event($parameters)
+ {
+ $ret = false;
+ $e = strtolower($parameters['Event']);
+ // $this->log("Got event.. $e");
+
+ $handler = '';
+ if(isset($this->event_handlers[$e])) $handler = $this->event_handlers[$e];
+ elseif(isset($this->event_handlers['*'])) $handler = $this->event_handlers['*'];
+
+ if(function_exists($handler))
+ {
+ // $this->log("Execute handler $handler");
+ $ret = $handler($e, $parameters, $this->server, $this->port);
+ }
+ else
+ $this->log("No event handler for event '$e'");
+ return $ret;
+ }
+ }
+?>
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/phpagi-fastagi.php
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/phpagi-fastagi.php (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/phpagi-fastagi.php) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/phpagi-fastagi.php (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/phpagi-fastagi.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,79 @@
+#!/usr/local/bin/php -q
+<?php
+ /**
+ * phpagi-fastagi.php : PHP FastAGI bootstrap
+ * Website: http://phpagi.sourceforge.net
+ *
+ * $Id: phpagi-fastagi.php,v 1.2 2005/05/25 18:43:48 pinhole Exp $
+ *
+ * Copyright (c) 2004, 2005 Matthew Asham <matthewa@bcwireless.net>, David Eder <david@eder.us>
+ * All Rights Reserved.
+ *
+ * This software is released under the terms of the GNU Lesser General Public License v2.1
+ * A copy of which is available from http://www.gnu.org/copyleft/lesser.html
+ *
+ * We would be happy to list your phpagi based application on the phpagi
+ * website. Drop me an Email if you'd like us to list your program.
+ *
+ * @package phpAGI
+ * @version 2.0
+ * @example docs/fastagi.xinetd Example xinetd config file
+ */
+
+ /**
+ * Written for PHP 4.3.4, should work with older PHP 4.x versions.
+ * Please submit bug reports, patches, etc to http://sourceforge.net/projects/phpagi/
+ * Gracias. :)
+ *
+ */
+
+ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'phpagi.php');
+
+ $fastagi = new AGI();
+
+ $fastagi->verbose(print_r($fastagi, true));
+
+ if(!isset($fastagi->config['fastagi']['basedir']))
+ $fastagi->config['fastagi']['basedir'] = dirname(__FILE__);
+
+ // perform some security checks
+
+ $script = $fastagi->config['fastagi']['basedir'] . DIRECTORY_SEPARATOR . $fastagi->request['agi_network_script'];
+
+ // in the same directory (or subdirectory)
+ $mydir = dirname($fastagi->config['fastagi']['basedir']) . DIRECTORY_SEPARATOR;
+ $dir = dirname($script) . DIRECTORY_SEPARATOR;
+ if(substr($dir, 0, strlen($mydir)) != $mydir)
+ {
+ $fastagi->conlog("$script is not allowed to execute.");
+ exit;
+ }
+
+ // make sure it exists
+ if(!file_exists($script))
+ {
+ $fastagi->conlog("$script does not exist.");
+ exit;
+ }
+
+ // drop privileges
+ if(isset($fastagi->config['fastagi']['setuid']) && $fastagi->config['fastagi']['setuid'])
+ {
+ $owner = fileowner($script);
+ $group = filegroup($script);
+ if(!posix_setgid($group) || !posix_setegid($group) || !posix_setuid($owner) || !posix_seteuid($owner))
+ {
+ $fastagi->conlog("failed to lower privileges.");
+ exit;
+ }
+ }
+
+ // make sure script is still readable
+ if(!is_readable($script))
+ {
+ $fastagi->conlog("$script is not readable.");
+ exit;
+ }
+
+ require_once($script);
+?>
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/phpagi.php
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/phpagi.php (from rev 15313, freeswitch/trunk/contrib/gled/php/phpagi-2.14/phpagi.php) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/phpagi.php (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/gled/php/phpagi-2.14/phpagi.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,1753 @@
+<?php
+
+ /**
+ * phpagi.php : PHP AGI Functions for Asterisk
+ * Website: http://phpagi.sourceforge.net/
+ *
+ * $Id: phpagi.php,v 2.14 2005/05/25 20:30:46 pinhole Exp $
+ *
+ * Copyright (c) 2003, 2004, 2005 Matthew Asham <matthewa@bcwireless.net>, David Eder <david@eder.us>
+ * All Rights Reserved.
+ *
+ * This software is released under the terms of the GNU Lesser General Public License v2.1
+ * A copy of which is available from http://www.gnu.org/copyleft/lesser.html
+ *
+ * We would be happy to list your phpagi based application on the phpagi
+ * website. Drop me an Email if you'd like us to list your program.
+ *
+ *
+ * Written for PHP 4.3.4, should work with older PHP 4.x versions.
+ *
+ * Please submit bug reports, patches, etc to http://sourceforge.net/projects/phpagi/
+ * Gracias. :)
+ *
+ *
+ * @package phpAGI
+ * @version 2.0
+ */
+
+/*
+ PATCH
+*/
+
+ function logthis($str) {
+ file_put_contents('/telephony/freeswitch/log/ivr.log',date("Y-m-d H:i:s").": $str\n",FILE_APPEND);
+ }
+
+ /**
+ */
+
+ if(!class_exists('AGI_AsteriskManager'))
+ {
+ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'phpagi-asmanager.php');
+ }
+
+ define('AST_CONFIG_DIR', '/pstn/confs/asterisk');
+ define('AST_SPOOL_DIR', '/pstn/system/var/spool/asterisk/');
+ define('AST_TMP_DIR', AST_SPOOL_DIR . '/tmp/');
+ define('DEFAULT_PHPAGI_CONFIG', AST_CONFIG_DIR . '/phpagi.conf');
+
+ define('AST_DIGIT_ANY', '0123456789#*');
+
+ define('AGIRES_OK', 200);
+
+ define('AST_STATE_DOWN', 0);
+ define('AST_STATE_RESERVED', 1);
+ define('AST_STATE_OFFHOOK', 2);
+ define('AST_STATE_DIALING', 3);
+ define('AST_STATE_RING', 4);
+ define('AST_STATE_RINGING', 5);
+ define('AST_STATE_UP', 6);
+ define('AST_STATE_BUSY', 7);
+ define('AST_STATE_DIALING_OFFHOOK', 8);
+ define('AST_STATE_PRERING', 9);
+
+ define('AUDIO_FILENO', 3); // STDERR_FILENO + 1
+
+ /**
+ * AGI class
+ *
+ * @package phpAGI
+ * @link http://www.voip-info.org/wiki-Asterisk+agi
+ * @example examples/dtmf.php Get DTMF tones from the user and say the digits
+ * @example examples/input.php Get text input from the user and say it back
+ * @example examples/ping.php Ping an IP address
+ */
+ class AGI
+ {
+ /**
+ * Request variables read in on initialization.
+ *
+ * Often contains any/all of the following:
+ * agi_request - name of agi script
+ * agi_channel - current channel
+ * agi_language - current language
+ * agi_type - channel type (SIP, ZAP, IAX, ...)
+ * agi_uniqueid - unique id based on unix time
+ * agi_callerid - callerID string
+ * agi_dnid - dialed number id
+ * agi_rdnis - referring DNIS number
+ * agi_context - current context
+ * agi_extension - extension dialed
+ * agi_priority - current priority
+ * agi_enhanced - value is 1.0 if started as an EAGI script
+ * agi_accountcode - set by SetAccount in the dialplan
+ * agi_network - value is yes if this is a fastagi
+ * agi_network_script - name of the script to execute
+ *
+ * NOTE: program arguments are still in $_SERVER['argv'].
+ *
+ * @var array
+ * @access public
+ */
+ var $request;
+
+ /**
+ * Config variables
+ *
+ * @var array
+ * @access public
+ */
+ var $config;
+
+ /**
+ * Asterisk Manager
+ *
+ * @var AGI_AsteriskManager
+ * @access public
+ */
+ var $asmanager;
+
+ /**
+ * Input Stream
+ *
+ * @access private
+ */
+ var $in = NULL;
+
+ /**
+ * Output Stream
+ *
+ * @access private
+ */
+ var $out = NULL;
+
+ /**
+ * Audio Stream
+ *
+ * @access public
+ */
+ var $audio = NULL;
+
+ /**
+ * Constructor
+ *
+ * @param string $config is the name of the config file to parse
+ * @param array $optconfig is an array of configuration vars and vals, stuffed into $this->config['phpagi']
+ */
+ function AGI($config=NULL, $optconfig=array())
+ {
+ // load config
+ if(!is_null($config) && file_exists($config))
+ $this->config = parse_ini_file($config, true);
+ elseif(file_exists(DEFAULT_PHPAGI_CONFIG))
+ $this->config = parse_ini_file(DEFAULT_PHPAGI_CONFIG, true);
+
+ // If optconfig is specified, stuff vals and vars into 'phpagi' config array.
+ foreach($optconfig as $var=>$val)
+ $this->config['phpagi'][$var] = $val;
+
+ // add default values to config for uninitialized values
+ if(!isset($this->config['phpagi']['error_handler'])) $this->config['phpagi']['error_handler'] = true;
+ if(!isset($this->config['phpagi']['debug'])) $this->config['phpagi']['debug'] = false;
+ if(!isset($this->config['phpagi']['admin'])) $this->config['phpagi']['admin'] = NULL;
+ if(!isset($this->config['phpagi']['tempdir'])) $this->config['phpagi']['tempdir'] = AST_TMP_DIR;
+
+ // festival TTS config
+ if(!isset($this->config['festival']['text2wave'])) $this->config['festival']['text2wave'] = $this->which('text2wave');
+
+ // swift TTS config
+ if(!isset($this->config['cepstral']['swift'])) $this->config['cepstral']['swift'] = $this->which('swift');
+
+ ob_implicit_flush(true);
+
+ // open stdin & stdout
+ $this->in = defined('STDIN') ? STDIN : fopen('php://stdin', 'r');
+ $this->out = defined('STDOUT') ? STDOUT : fopen('php://stdout', 'w');
+
+ // initialize error handler
+ if($this->config['phpagi']['error_handler'] == true)
+ {
+ set_error_handler('phpagi_error_handler');
+ global $phpagi_error_handler_email;
+ $phpagi_error_handler_email = $this->config['phpagi']['admin'];
+ error_reporting(E_ALL);
+ }
+
+ // make sure temp folder exists
+ $this->make_folder($this->config['phpagi']['tempdir']);
+
+ // read the request
+ $str = fgets($this->in);
+ while($str != "\n")
+ {
+ $this->request[substr($str, 0, strpos($str, ':'))] = trim(substr($str, strpos($str, ':') + 1));
+ $str = fgets($this->in);
+ }
+
+ // open audio if eagi detected
+ if($this->request['agi_enhanced'] == '1.0')
+ {
+ if(file_exists('/proc/' . getmypid() . '/fd/3'))
+ $this->audio = fopen('/proc/' . getmypid() . '/fd/3', 'r');
+ elseif(file_exists('/dev/fd/3'))
+ {
+ // may need to mount fdescfs
+ $this->audio = fopen('/dev/fd/3', 'r');
+ }
+ else
+ $this->conlog('Unable to open audio stream');
+
+ if($this->audio) stream_set_blocking($this->audio, 0);
+ }
+
+// $this->conlog('AGI Request:');
+// $this->conlog(print_r($this->request, true));
+// $this->conlog('PHPAGI internal configuration:');
+// $this->conlog(print_r($this->config, true));
+ }
+
+ // *********************************************************************************************************
+ // ** COMMANDS **
+ // *********************************************************************************************************
+
+ /**
+ * Answer channel if not already in answer state.
+ *
+ * @link http://www.voip-info.org/wiki-answer
+ * @example examples/dtmf.php Get DTMF tones from the user and say the digits
+ * @example examples/input.php Get text input from the user and say it back
+ * @example examples/ping.php Ping an IP address
+ *
+ * @return array, see evaluate for return information. ['result'] is 0 on success, -1 on failure.
+ */
+ function answer()
+ {
+ return $this->evaluate('ANSWER');
+ }
+
+ /**
+ * Get the status of the specified channel. If no channel name is specified, return the status of the current channel.
+ *
+ * @link http://www.voip-info.org/wiki-channel+status
+ * @param string $channel
+ * @return array, see evaluate for return information. ['data'] contains description.
+ */
+ function channel_status($channel='')
+ {
+ $ret = $this->evaluate("CHANNEL STATUS $channel");
+ switch($ret['result'])
+ {
+ case -1: $ret['data'] = trim("There is no channel that matches $channel"); break;
+ case AST_STATE_DOWN: $ret['data'] = 'Channel is down and available'; break;
+ case AST_STATE_RESERVED: $ret['data'] = 'Channel is down, but reserved'; break;
+ case AST_STATE_OFFHOOK: $ret['data'] = 'Channel is off hook'; break;
+ case AST_STATE_DIALING: $ret['data'] = 'Digits (or equivalent) have been dialed'; break;
+ case AST_STATE_RING: $ret['data'] = 'Line is ringing'; break;
+ case AST_STATE_RINGING: $ret['data'] = 'Remote end is ringing'; break;
+ case AST_STATE_UP: $ret['data'] = 'Line is up'; break;
+ case AST_STATE_BUSY: $ret['data'] = 'Line is busy'; break;
+ case AST_STATE_DIALING_OFFHOOK: $ret['data'] = 'Digits (or equivalent) have been dialed while offhook'; break;
+ case AST_STATE_PRERING: $ret['data'] = 'Channel has detected an incoming call and is waiting for ring'; break;
+ default: $ret['data'] = "Unknown ({$ret['result']})"; break;
+ }
+ return $ret;
+ }
+
+ /**
+ * Deletes an entry in the Asterisk database for a given family and key.
+ *
+ * @link http://www.voip-info.org/wiki-database+del
+ * @param string $family
+ * @param string $key
+ * @return array, see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise.
+ */
+ function database_del($family, $key)
+ {
+ return $this->evaluate("DATABASE DEL \"$family\" \"$key\"");
+ }
+
+ /**
+ * Deletes a family or specific keytree within a family in the Asterisk database.
+ *
+ * @link http://www.voip-info.org/wiki-database+deltree
+ * @param string $family
+ * @param string $keytree
+ * @return array, see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise.
+ */
+ function database_deltree($family, $keytree='')
+ {
+ $cmd = "DATABASE DELTREE \"$family\"";
+ if($keytree != '') $cmd .= " \"$keytree\"";
+ return $this->evaluate($cmd);
+ }
+
+ /**
+ * Retrieves an entry in the Asterisk database for a given family and key.
+ *
+ * @link http://www.voip-info.org/wiki-database+get
+ * @param string $family
+ * @param string $key
+ * @return array, see evaluate for return information. ['result'] is 1 on sucess, 0 failure. ['data'] holds the value
+ */
+ function database_get($family, $key)
+ {
+ return $this->evaluate("DATABASE GET \"$family\ \"$key\"");
+ }
+
+ /**
+ * Adds or updates an entry in the Asterisk database for a given family, key, and value.
+ *
+ * @param string $family
+ * @param string $key
+ * @param string $value
+ * @return array, see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise
+ */
+ function database_put($family, $key, $value)
+ {
+ $value = str_replace("\n", '\n', addslashes($value));
+ return $this->evaluate("DATABASE PUT \"$family\" \"$key\" \"$value\"");
+ }
+
+ /**
+ * Executes the specified Asterisk application with given options.
+ *
+ * @link http://www.voip-info.org/wiki-exec
+ * @link http://www.voip-info.org/wiki-Asterisk+-+documentation+of+application+commands
+ * @param string $application
+ * @param mixed $options
+ * @return array, see evaluate for return information. ['result'] is whatever the application returns, or -2 on failure to find application
+ */
+ function exec($application, $options='')
+ {
+ if(is_array($options)) $options = join('|', $options);
+ return $this->evaluate("EXEC $application $options");
+ }
+
+ /**
+ * Plays the given file and receives DTMF data.
+ *
+ * This is similar to STREAM FILE, but this command can accept and return many DTMF digits,
+ * while STREAM FILE returns immediately after the first DTMF digit is detected.
+ *
+ * Asterisk looks for the file to play in /var/lib/asterisk/sounds by default.
+ *
+ * If the user doesn't press any keys when the message plays, there is $timeout milliseconds
+ * of silence then the command ends.
+ *
+ * The user has the opportunity to press a key at any time during the message or the
+ * post-message silence. If the user presses a key while the message is playing, the
+ * message stops playing. When the first key is pressed a timer starts counting for
+ * $timeout milliseconds. Every time the user presses another key the timer is restarted.
+ * The command ends when the counter goes to zero or the maximum number of digits is entered,
+ * whichever happens first.
+ *
+ * If you don't specify a time out then a default timeout of 2000 is used following a pressed
+ * digit. If no digits are pressed then 6 seconds of silence follow the message.
+ *
+ * If you don't specify $max_digits then the user can enter as many digits as they want.
+ *
+ * Pressing the # key has the same effect as the timer running out: the command ends and
+ * any previously keyed digits are returned. A side effect of this is that there is no
+ * way to read a # key using this command.
+ *
+ * @example examples/ping.php Ping an IP address
+ *
+ * @link http://www.voip-info.org/wiki-get+data
+ * @param string $filename file to play. Do not include file extension.
+ * @param integer $timeout milliseconds
+ * @param integer $max_digits
+ * @return array, see evaluate for return information. ['result'] holds the digits and ['data'] holds the timeout if present.
+ *
+ * This differs from other commands with return DTMF as numbers representing ASCII characters.
+ */
+ function get_data($filename, $timeout=NULL, $max_digits=NULL)
+ {
+ return $this->evaluate(rtrim("GET DATA $filename $timeout $max_digits"));
+ }
+
+ /**
+ * Fetch the value of a variable.
+ *
+ * Does not work with global variables. Does not work with some variables that are generated by modules.
+ *
+ * @link http://www.voip-info.org/wiki-get+variable
+ * @link http://www.voip-info.org/wiki-Asterisk+variables
+ * @param string $variable name
+ * @return array, see evaluate for return information. ['result'] is 0 if variable hasn't been set, 1 if it has. ['data'] holds the value.
+ */
+ function get_variable($variable)
+ {
+ return $this->evaluate("GET VARIABLE $variable");
+ }
+
+ /**
+ * Hangup the specified channel. If no channel name is given, hang up the current channel.
+ *
+ * With power comes responsibility. Hanging up channels other than your own isn't something
+ * that is done routinely. If you are not sure why you are doing so, then don't.
+ *
+ * @link http://www.voip-info.org/wiki-hangup
+ * @example examples/dtmf.php Get DTMF tones from the user and say the digits
+ * @example examples/input.php Get text input from the user and say it back
+ * @example examples/ping.php Ping an IP address
+ *
+ * @param string $channel
+ * @return array, see evaluate for return information. ['result'] is 1 on success, -1 on failure.
+ */
+ function hangup($channel='')
+ {
+ return $this->evaluate("HANGUP $channel");
+ }
+
+ /**
+ * Does nothing.
+ *
+ * @link http://www.voip-info.org/wiki-noop
+ * @return array, see evaluate for return information.
+ */
+ function noop()
+ {
+ return $this->evaluate('NOOP');
+ }
+
+ /**
+ * Receive a character of text from a connected channel. Waits up to $timeout milliseconds for
+ * a character to arrive, or infinitely if $timeout is zero.
+ *
+ * @link http://www.voip-info.org/wiki-receive+char
+ * @param integer $timeout milliseconds
+ * @return array, see evaluate for return information. ['result'] is 0 on timeout or not supported, -1 on failure. Otherwise
+ * it is the decimal value of the DTMF tone. Use chr() to convert to ASCII.
+ */
+ function receive_char($timeout=-1)
+ {
+ return $this->evaluate("RECEIVE CHAR $timeout");
+ }
+
+ /**
+ * Record sound to a file until an acceptable DTMF digit is received or a specified amount of
+ * time has passed. Optionally the file BEEP is played before recording begins.
+ *
+ * @link http://www.voip-info.org/wiki-record+file
+ * @param string $file to record, without extension, often created in /var/lib/asterisk/sounds
+ * @param string $format of the file. GSM and WAV are commonly used formats. MP3 is read-only and thus cannot be used.
+ * @param string $escape_digits
+ * @param integer $timeout is the maximum record time in milliseconds, or -1 for no timeout.
+ * @param integer $offset to seek to without exceeding the end of the file.
+ * @param boolean $beep
+ * @param integer $silence number of seconds of silence allowed before the function returns despite the
+ * lack of dtmf digits or reaching timeout.
+ * @return array, see evaluate for return information. ['result'] is -1 on error, 0 on hangup, otherwise a decimal value of the
+ * DTMF tone. Use chr() to convert to ASCII.
+ */
+ function record_file($file, $format, $escape_digits='', $timeout=-1, $offset=NULL, $beep=false, $silence=NULL)
+ {
+ $cmd = trim("RECORD FILE $file $format \"$escape_digits\" $timeout $offset");
+ if($beep) $cmd .= ' BEEP';
+ if(!is_null($silence)) $cmd .= " s=$silence";
+ return $this->evaluate($cmd);
+ }
+
+ /**
+ * Say the given digit string, returning early if any of the given DTMF escape digits are received on the channel.
+ *
+ * @link http://www.voip-info.org/wiki-say+digits
+ * @param integer $digits
+ * @param string $escape_digits
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no
+ * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
+ */
+ function say_digits($digits, $escape_digits='')
+ {
+ return $this->evaluate("SAY DIGITS $digits \"$escape_digits\"");
+ }
+
+ /**
+ * Say the given number, returning early if any of the given DTMF escape digits are received on the channel.
+ *
+ * @link http://www.voip-info.org/wiki-say+number
+ * @param integer $number
+ * @param string $escape_digits
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no
+ * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
+ */
+ function say_number($number, $escape_digits='')
+ {
+ return $this->evaluate("SAY NUMBER $number \"$escape_digits\"");
+ }
+
+ /**
+ * Say the given character string, returning early if any of the given DTMF escape digits are received on the channel.
+ *
+ * @link http://www.voip-info.org/wiki-say+phonetic
+ * @param string $text
+ * @param string $escape_digits
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no
+ * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
+ */
+ function say_phonetic($text, $escape_digits='')
+ {
+ return $this->evaluate("SAY PHONETIC $text \"$escape_digits\"");
+ }
+
+ /**
+ * Say a given time, returning early if any of the given DTMF escape digits are received on the channel.
+ *
+ * @link http://www.voip-info.org/wiki-say+time
+ * @param integer $time number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
+ * @param string $escape_digits
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no
+ * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
+ */
+ function say_time($time=NULL, $escape_digits='')
+ {
+ if(is_null($time)) $time = time();
+ return $this->evaluate("SAY TIME $time \"$escape_digits\"");
+ }
+
+ /**
+ * Send the specified image on a channel.
+ *
+ * Most channels do not support the transmission of images.
+ *
+ * @link http://www.voip-info.org/wiki-send+image
+ * @param string $image without extension, often in /var/lib/asterisk/images
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if the image is sent or
+ * channel does not support image transmission.
+ */
+ function send_image($image)
+ {
+ return $this->evaluate("SEND IMAGE $image");
+ }
+
+ /**
+ * Send the given text to the connected channel.
+ *
+ * Most channels do not support transmission of text.
+ *
+ * @link http://www.voip-info.org/wiki-send+text
+ * @param $text
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if the text is sent or
+ * channel does not support text transmission.
+ */
+ function send_text($text)
+ {
+ return $this->evaluate("SEND TEXT \"$text\"");
+ }
+
+ /**
+ * Cause the channel to automatically hangup at $time seconds in the future.
+ * If $time is 0 then the autohangup feature is disabled on this channel.
+ *
+ * If the channel is hungup prior to $time seconds, this setting has no effect.
+ *
+ * @link http://www.voip-info.org/wiki-set+autohangup
+ * @param integer $time until automatic hangup
+ * @return array, see evaluate for return information.
+ */
+ function set_autohangup($time=0)
+ {
+ return $this->evaluate("SET AUTOHANGUP $time");
+ }
+
+ /**
+ * Changes the caller ID of the current channel.
+ *
+ * @link http://www.voip-info.org/wiki-set+callerid
+ * @param string $cid example: "John Smith"<1234567>
+ * This command will let you take liberties with the <caller ID specification> but the format shown in the example above works
+ * well: the name enclosed in double quotes followed immediately by the number inside angle brackets. If there is no name then
+ * you can omit it. If the name contains no spaces you can omit the double quotes around it. The number must follow the name
+ * immediately; don't put a space between them. The angle brackets around the number are necessary; if you omit them the
+ * number will be considered to be part of the name.
+ * @return array, see evaluate for return information.
+ */
+ function set_callerid($cid)
+ {
+ return $this->evaluate("SET CALLERID $cid");
+ }
+
+ /**
+ * Sets the context for continuation upon exiting the application.
+ *
+ * Setting the context does NOT automatically reset the extension and the priority; if you want to start at the top of the new
+ * context you should set extension and priority yourself.
+ *
+ * If you specify a non-existent context you receive no error indication (['result'] is still 0) but you do get a
+ * warning message on the Asterisk console.
+ *
+ * @link http://www.voip-info.org/wiki-set+context
+ * @param string $context
+ * @return array, see evaluate for return information.
+ */
+ function set_context($context)
+ {
+ return $this->evaluate("SET CONTEXT $context");
+ }
+
+ /**
+ * Set the extension to be used for continuation upon exiting the application.
+ *
+ * Setting the extension does NOT automatically reset the priority. If you want to start with the first priority of the
+ * extension you should set the priority yourself.
+ *
+ * If you specify a non-existent extension you receive no error indication (['result'] is still 0) but you do
+ * get a warning message on the Asterisk console.
+ *
+ * @link http://www.voip-info.org/wiki-set+extension
+ * @param string $extension
+ * @return array, see evaluate for return information.
+ */
+ function set_extension($extension)
+ {
+ return $this->evaluate("SET EXTENSION $extension");
+ }
+
+ /**
+ * Enable/Disable Music on hold generator.
+ *
+ * @link http://www.voip-info.org/wiki-set+music
+ * @param boolean $enabled
+ * @param string $class
+ * @return array, see evaluate for return information.
+ */
+ function set_music($enabled=true, $class='')
+ {
+ $enabled = ($enabled) ? 'ON' : 'OFF';
+ return $this->evaluate("SET MUSIC $enabled $class");
+ }
+
+ /**
+ * Set the priority to be used for continuation upon exiting the application.
+ *
+ * If you specify a non-existent priority you receive no error indication (['result'] is still 0)
+ * and no warning is issued on the Asterisk console.
+ *
+ * @link http://www.voip-info.org/wiki-set+priority
+ * @param integer $priority
+ * @return array, see evaluate for return information.
+ */
+ function set_priority($priority)
+ {
+ return $this->evaluate("SET PRIORITY $priority");
+ }
+
+ /**
+ * Sets a variable to the specified value. The variables so created can later be used by later using ${<variablename>}
+ * in the dialplan.
+ *
+ * These variables live in the channel Asterisk creates when you pickup a phone and as such they are both local and temporary.
+ * Variables created in one channel can not be accessed by another channel. When you hang up the phone, the channel is deleted
+ * and any variables in that channel are deleted as well.
+ *
+ * @link http://www.voip-info.org/wiki-set+variable
+ * @param string $variable is case sensitive
+ * @param string $value
+ * @return array, see evaluate for return information.
+ */
+ function set_variable($variable, $value)
+ {
+ $value = str_replace("\n", '\n', addslashes($value));
+ return $this->evaluate("SET VARIABLE $variable \"$value\"");
+ }
+
+ /**
+ * Play the given audio file, allowing playback to be interrupted by a DTMF digit. This command is similar to the GET DATA
+ * command but this command returns after the first DTMF digit has been pressed while GET DATA can accumulated any number of
+ * digits before returning.
+ *
+ * @example examples/ping.php Ping an IP address
+ *
+ * @link http://www.voip-info.org/wiki-stream+file
+ * @param string $filename without extension, often in /var/lib/asterisk/sounds
+ * @param string $escape_digits
+ * @param integer $offset
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no
+ * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
+ */
+ function stream_file($filename, $escape_digits='', $offset=0)
+ {
+ return $this->evaluate("STREAM FILE $filename \"$escape_digits\" $offset");
+ }
+
+ /**
+ * Enable or disable TDD transmission/reception on the current channel.
+ *
+ * @link http://www.voip-info.org/wiki-tdd+mode
+ * @param string $setting can be on, off or mate
+ * @return array, see evaluate for return information. ['result'] is 1 on sucess, 0 if the channel is not TDD capable.
+ */
+ function tdd_mode($setting)
+ {
+ return $this->evaluate("TDD MODE $setting");
+ }
+
+ /**
+ * Sends $message to the Asterisk console via the 'verbose' message system.
+ *
+ * If the Asterisk verbosity level is $level or greater, send $message to the console.
+ *
+ * The Asterisk verbosity system works as follows. The Asterisk user gets to set the desired verbosity at startup time or later
+ * using the console 'set verbose' command. Messages are displayed on the console if their verbose level is less than or equal
+ * to desired verbosity set by the user. More important messages should have a low verbose level; less important messages
+ * should have a high verbose level.
+ *
+ * @link http://www.voip-info.org/wiki-verbose
+ * @param string $message
+ * @param integer $level from 1 to 4
+ * @return array, see evaluate for return information.
+ */
+ function verbose($message, $level=1)
+ {
+ foreach(explode("\n", str_replace("\r\n", "\n", print_r($message, true))) as $msg)
+ {
+ @syslog(LOG_WARNING, $msg);
+ $ret = $this->evaluate("VERBOSE \"$msg\" $level");
+ }
+ return $ret;
+ }
+
+ /**
+ * Waits up to $timeout milliseconds for channel to receive a DTMF digit.
+ *
+ * @link http://www.voip-info.org/wiki-wait+for+digit
+ * @param integer $timeout in millisecons. Use -1 for the timeout value if you want the call to wait indefinitely.
+ * @return array, see evaluate for return information. ['result'] is 0 if wait completes with no
+ * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
+ */
+ function wait_for_digit($timeout=-1)
+ {
+ return $this->evaluate("WAIT FOR DIGIT $timeout");
+ }
+
+
+ // *********************************************************************************************************
+ // ** APPLICATIONS **
+ // *********************************************************************************************************
+
+ /**
+ * Set absolute maximum time of call.
+ *
+ * Note that the timeout is set from the current time forward, not counting the number of seconds the call has already been up.
+ * Each time you call AbsoluteTimeout(), all previous absolute timeouts are cancelled.
+ * Will return the call to the T extension so that you can playback an explanatory note to the calling party (the called party
+ * will not hear that)
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+-+documentation+of+application+commands
+ * @link http://www.dynx.net/ASTERISK/AGI/ccard/agi-ccard.agi
+ * @param $seconds allowed, 0 disables timeout
+ * @return array, see evaluate for return information.
+ */
+ function exec_absolutetimeout($seconds=0)
+ {
+ return $this->exec('AbsoluteTimeout', $seconds);
+ }
+
+ /**
+ * Executes an AGI compliant application.
+ *
+ * @param string $command
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or if application requested hangup, or 0 on non-hangup exit.
+ * @param string $args
+ */
+ function exec_agi($command, $args)
+ {
+ return $this->exec("AGI $command", $args);
+ }
+
+ /**
+ * Set Language.
+ *
+ * @param string $language code
+ * @return array, see evaluate for return information.
+ */
+ function exec_setlanguage($language='en')
+ {
+ return $this->exec('SetLanguage', $language);
+ }
+
+ /**
+ * Do ENUM Lookup.
+ *
+ * Note: to retrieve the result, use
+ * get_variable('ENUM');
+ *
+ * @param $exten
+ * @return array, see evaluate for return information.
+ */
+ function exec_enumlookup($exten)
+ {
+ return $this->exec('EnumLookup', $exten);
+ }
+
+ /**
+ * Dial.
+ *
+ * Dial takes input from ${VXML_URL} to send XML Url to Cisco 7960
+ * Dial takes input from ${ALERT_INFO} to set ring cadence for Cisco phones
+ * Dial returns ${CAUSECODE}: If the dial failed, this is the errormessage.
+ * Dial returns ${DIALSTATUS}: Text code returning status of last dial attempt.
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+cmd+Dial
+ * @param string $type
+ * @param string $identifier
+ * @param integer $timeout
+ * @param string $options
+ * @param string $url
+ * @return array, see evaluate for return information.
+ */
+ function exec_dial($type, $identifier, $timeout=NULL, $options=NULL, $url=NULL)
+ {
+ return $this->exec('Dial', trim("$type/$identifier|$timeout|$options|$url", '|'));
+ }
+
+ /**
+ * Goto.
+ *
+ * This function takes three arguments: context,extension, and priority, but the leading arguments
+ * are optional, not the trailing arguments. Thuse goto($z) sets the priority to $z.
+ *
+ * @param string $a
+ * @param string $b;
+ * @param string $c;
+ * @return array, see evaluate for return information.
+ */
+ function exec_goto($a, $b=NULL, $c=NULL)
+ {
+ return $this->exec('Goto', trim("$a|$b|$c", '|'));
+ }
+
+
+ // *********************************************************************************************************
+ // ** FAST PASSING **
+ // *********************************************************************************************************
+
+ /**
+ * Say the given digit string, returning early if any of the given DTMF escape digits are received on the channel.
+ * Return early if $buffer is adequate for request.
+ *
+ * @link http://www.voip-info.org/wiki-say+digits
+ * @param string $buffer
+ * @param integer $digits
+ * @param string $escape_digits
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no
+ * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
+ */
+ function fastpass_say_digits(&$buffer, $digits, $escape_digits='')
+ {
+ $proceed = false;
+ if($escape_digits != '' && $buffer != '')
+ {
+ if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1}))
+ $proceed = true;
+ }
+ if($buffer == '' || $proceed)
+ {
+ $res = $this->say_digits($digits, $escape_digits);
+ if($res['code'] == AGIRES_OK && $res['result'] > 0)
+ $buffer .= chr($res['result']);
+ return $res;
+ }
+ return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}));
+ }
+
+ /**
+ * Say the given number, returning early if any of the given DTMF escape digits are received on the channel.
+ * Return early if $buffer is adequate for request.
+ *
+ * @link http://www.voip-info.org/wiki-say+number
+ * @param string $buffer
+ * @param integer $number
+ * @param string $escape_digits
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no
+ * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
+ */
+ function fastpass_say_number(&$buffer, $number, $escape_digits='')
+ {
+ $proceed = false;
+ if($escape_digits != '' && $buffer != '')
+ {
+ if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1}))
+ $proceed = true;
+ }
+ if($buffer == '' || $proceed)
+ {
+ $res = $this->say_number($number, $escape_digits);
+ if($res['code'] == AGIRES_OK && $res['result'] > 0)
+ $buffer .= chr($res['result']);
+ return $res;
+ }
+ return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}));
+ }
+
+ /**
+ * Say the given character string, returning early if any of the given DTMF escape digits are received on the channel.
+ * Return early if $buffer is adequate for request.
+ *
+ * @link http://www.voip-info.org/wiki-say+phonetic
+ * @param string $buffer
+ * @param string $text
+ * @param string $escape_digits
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no
+ * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
+ */
+ function fastpass_say_phonetic(&$buffer, $text, $escape_digits='')
+ {
+ $proceed = false;
+ if($escape_digits != '' && $buffer != '')
+ {
+ if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1}))
+ $proceed = true;
+ }
+ if($buffer == '' || $proceed)
+ {
+ $res = $this->say_phonetic($text, $escape_digits);
+ if($res['code'] == AGIRES_OK && $res['result'] > 0)
+ $buffer .= chr($res['result']);
+ return $res;
+ }
+ return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}));
+ }
+
+ /**
+ * Say a given time, returning early if any of the given DTMF escape digits are received on the channel.
+ * Return early if $buffer is adequate for request.
+ *
+ * @link http://www.voip-info.org/wiki-say+time
+ * @param string $buffer
+ * @param integer $time number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
+ * @param string $escape_digits
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no
+ * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
+ */
+ function fastpass_say_time(&$buffer, $time=NULL, $escape_digits='')
+ {
+ $proceed = false;
+ if($escape_digits != '' && $buffer != '')
+ {
+ if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1}))
+ $proceed = true;
+ }
+ if($buffer == '' || $proceed)
+ {
+ $res = $this->say_time($time, $escape_digits);
+ if($res['code'] == AGIRES_OK && $res['result'] > 0)
+ $buffer .= chr($res['result']);
+ return $res;
+ }
+ return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}));
+ }
+
+ /**
+ * Play the given audio file, allowing playback to be interrupted by a DTMF digit. This command is similar to the GET DATA
+ * command but this command returns after the first DTMF digit has been pressed while GET DATA can accumulated any number of
+ * digits before returning.
+ * Return early if $buffer is adequate for request.
+ *
+ * @link http://www.voip-info.org/wiki-stream+file
+ * @param string $buffer
+ * @param string $filename without extension, often in /var/lib/asterisk/sounds
+ * @param string $escape_digits
+ * @param integer $offset
+ * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no
+ * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
+ */
+ function fastpass_stream_file(&$buffer, $filename, $escape_digits='', $offset=0)
+ {
+ $proceed = false;
+ if($escape_digits != '' && $buffer != '')
+ {
+ if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1}))
+ $proceed = true;
+ }
+ if($buffer == '' || $proceed)
+ {
+ $res = $this->stream_file($filename, $escape_digits, $offset);
+ if($res['code'] == AGIRES_OK && $res['result'] > 0)
+ $buffer .= chr($res['result']);
+ return $res;
+ }
+ return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}), 'endpos'=>0);
+ }
+
+ /**
+ * Use festival to read text.
+ * Return early if $buffer is adequate for request.
+ *
+ * @link http://www.cstr.ed.ac.uk/projects/festival/
+ * @param string $buffer
+ * @param string $text
+ * @param string $escape_digits
+ * @param integer $frequency
+ * @return array, see evaluate for return information.
+ */
+ function fastpass_text2wav(&$buffer, $text, $escape_digits='', $frequency=8000)
+ {
+ $proceed = false;
+ if($escape_digits != '' && $buffer != '')
+ {
+ if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1}))
+ $proceed = true;
+ }
+ if($buffer == '' || $proceed)
+ {
+ $res = $this->text2wav($text, $escape_digits, $frequency);
+ if($res['code'] == AGIRES_OK && $res['result'] > 0)
+ $buffer .= chr($res['result']);
+ return $res;
+ }
+ return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}), 'endpos'=>0);
+ }
+
+ /**
+ * Use Cepstral Swift to read text.
+ * Return early if $buffer is adequate for request.
+ *
+ * @link http://www.cepstral.com/
+ * @param string $buffer
+ * @param string $text
+ * @param string $escape_digits
+ * @param integer $frequency
+ * @return array, see evaluate for return information.
+ */
+ function fastpass_swift(&$buffer, $text, $escape_digits='', $frequency=8000, $voice=NULL)
+ {
+ $proceed = false;
+ if($escape_digits != '' && $buffer != '')
+ {
+ if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1}))
+ $proceed = true;
+ }
+ if($buffer == '' || $proceed)
+ {
+ $res = $this->swift($text, $escape_digits, $frequency, $voice);
+ if($res['code'] == AGIRES_OK && $res['result'] > 0)
+ $buffer .= chr($res['result']);
+ return $res;
+ }
+ return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}), 'endpos'=>0);
+ }
+
+ /**
+ * Say Puncutation in a string.
+ * Return early if $buffer is adequate for request.
+ *
+ * @param string $buffer
+ * @param string $text
+ * @param string $escape_digits
+ * @param integer $frequency
+ * @return array, see evaluate for return information.
+ */
+ function fastpass_say_punctuation(&$buffer, $text, $escape_digits='', $frequency=8000)
+ {
+ $proceed = false;
+ if($escape_digits != '' && $buffer != '')
+ {
+ if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1}))
+ $proceed = true;
+ }
+ if($buffer == '' || $proceed)
+ {
+ $res = $this->say_punctuation($text, $escape_digits, $frequency);
+ if($res['code'] == AGIRES_OK && $res['result'] > 0)
+ $buffer .= chr($res['result']);
+ return $res;
+ }
+ return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}));
+ }
+
+ /**
+ * Plays the given file and receives DTMF data.
+ * Return early if $buffer is adequate for request.
+ *
+ * This is similar to STREAM FILE, but this command can accept and return many DTMF digits,
+ * while STREAM FILE returns immediately after the first DTMF digit is detected.
+ *
+ * Asterisk looks for the file to play in /var/lib/asterisk/sounds by default.
+ *
+ * If the user doesn't press any keys when the message plays, there is $timeout milliseconds
+ * of silence then the command ends.
+ *
+ * The user has the opportunity to press a key at any time during the message or the
+ * post-message silence. If the user presses a key while the message is playing, the
+ * message stops playing. When the first key is pressed a timer starts counting for
+ * $timeout milliseconds. Every time the user presses another key the timer is restarted.
+ * The command ends when the counter goes to zero or the maximum number of digits is entered,
+ * whichever happens first.
+ *
+ * If you don't specify a time out then a default timeout of 2000 is used following a pressed
+ * digit. If no digits are pressed then 6 seconds of silence follow the message.
+ *
+ * If you don't specify $max_digits then the user can enter as many digits as they want.
+ *
+ * Pressing the # key has the same effect as the timer running out: the command ends and
+ * any previously keyed digits are returned. A side effect of this is that there is no
+ * way to read a # key using this command.
+ *
+ * @link http://www.voip-info.org/wiki-get+data
+ * @param string $buffer
+ * @param string $filename file to play. Do not include file extension.
+ * @param integer $timeout milliseconds
+ * @param integer $max_digits
+ * @return array, see evaluate for return information. ['result'] holds the digits and ['data'] holds the timeout if present.
+ *
+ * This differs from other commands with return DTMF as numbers representing ASCII characters.
+ */
+ function fastpass_get_data(&$buffer, $filename, $timeout=NULL, $max_digits=NULL)
+ {
+ if(is_null($max_digits) || strlen($buffer) < $max_digits)
+ {
+ if($buffer == '')
+ {
+ $res = $this->get_data($filename, $timeout, $max_digits);
+ if($res['code'] == AGIRES_OK)
+ $buffer .= $res['result'];
+ return $res;
+ }
+ else
+ {
+ while(is_null($max_digits) || strlen($buffer) < $max_digits)
+ {
+ $res = $this->wait_for_digit();
+ if($res['code'] != AGIRES_OK) return $res;
+ if($res['result'] == ord('#')) break;
+ $buffer .= chr($res['result']);
+ }
+ }
+ }
+ return array('code'=>AGIRES_OK, 'result'=>$buffer);
+ }
+
+ // *********************************************************************************************************
+ // ** DERIVED **
+ // *********************************************************************************************************
+
+ /**
+ * Menu.
+ *
+ * This function presents the user with a menu and reads the response
+ *
+ * @param array $choices has the following structure:
+ * array('1'=>'*Press 1 for this', // festival reads if prompt starts with *
+ * '2'=>'some-gsm-without-extension',
+ * '*'=>'*Press star for help');
+ * @return mixed key pressed on sucess, -1 on failure
+ */
+ function menu($choices, $timeout=2000)
+ {
+ $keys = join('', array_keys($choices));
+ $choice = NULL;
+ while(is_null($choice))
+ {
+ foreach($choices as $prompt)
+ {
+ if($prompt{0} == '*')
+ $ret = $this->text2wav(substr($prompt, 1), $keys);
+ else
+ $ret = $this->stream_file($prompt, $keys);
+
+ if($ret['code'] != AGIRES_OK || $ret['result'] == -1)
+ {
+ $choice = -1;
+ break;
+ }
+
+ if($ret['result'] != 0)
+ {
+ $choice = chr($ret['result']);
+ break;
+ }
+ }
+
+ if(is_null($choice))
+ {
+ $ret = $this->get_data('beep', $timeout, 1);
+ if($ret['code'] != AGIRES_OK || $ret['result'] == -1)
+ $choice = -1;
+ elseif($ret['result'] != '' && strpos(' '.$keys, $ret['result']))
+ $choice = $ret['result'];
+ }
+ }
+ return $choice;
+ }
+
+ /**
+ * Goto - Set context, extension and priority.
+ *
+ * @param string $context
+ * @param string $extension
+ * @param string $priority
+ */
+ function goto($context, $extension='s', $priority=1)
+ {
+ $this->set_context($context);
+ $this->set_extension($extension);
+ $this->set_priority($priority);
+ }
+
+ /**
+ * Parse caller id.
+ *
+ * @example examples/dtmf.php Get DTMF tones from the user and say the digits
+ * @example examples/input.php Get text input from the user and say it back
+ *
+ * "name" <proto:user@server:port>
+ *
+ * @param string $callerid
+ * @return array('Name'=>$name, 'Number'=>$number)
+ */
+ function parse_callerid($callerid=NULL)
+ {
+ if(is_null($callerid))
+ $callerid = $this->request['agi_callerid'];
+
+ $ret = array('name'=>'', 'protocol'=>'', 'username'=>'', 'host'=>'', 'port'=>'');
+ $callerid = trim($callerid);
+
+ if($callerid{0} == '"' || $callerid{0} == "'")
+ {
+ $d = $callerid{0};
+ $callerid = explode($d, substr($callerid, 1));
+ $ret['name'] = array_shift($callerid);
+ $callerid = join($d, $callerid);
+ }
+
+ $callerid = explode('@', trim($callerid, '<> '));
+ $username = explode(':', array_shift($callerid));
+ if(count($username) == 1)
+ $ret['username'] = $username[0];
+ else
+ {
+ $ret['protocol'] = array_shift($username);
+ $ret['username'] = join(':', $username);
+ }
+
+ $callerid = join('@', $callerid);
+ $host = explode(':', $callerid);
+ if(count($host) == 1)
+ $ret['host'] = $host[0];
+ else
+ {
+ $ret['host'] = array_shift($host);
+ $ret['port'] = join(':', $host);
+ }
+
+ return $ret;
+ }
+
+ /**
+ * Use festival to read text.
+ *
+ * @example examples/dtmf.php Get DTMF tones from the user and say the digits
+ * @example examples/input.php Get text input from the user and say it back
+ * @example examples/ping.php Ping an IP address
+ *
+ * @link http://www.cstr.ed.ac.uk/projects/festival/
+ * @param string $text
+ * @param string $escape_digits
+ * @param integer $frequency
+ * @return array, see evaluate for return information.
+ */
+ function text2wav($text, $escape_digits='', $frequency=8000)
+ {
+ $text = trim($text);
+ if($text == '') return true;
+
+ $hash = md5($text);
+ $fname = $this->config['phpagi']['tempdir'] . DIRECTORY_SEPARATOR;
+ $fname .= 'text2wav_' . $hash;
+
+ // create wave file
+ if(!file_exists("$fname.wav"))
+ {
+ // write text file
+ if(!file_exists("$fname.txt"))
+ {
+ $fp = fopen("$fname.txt", 'w');
+ fputs($fp, $text);
+ fclose($fp);
+ }
+
+ shell_exec("{$this->config['festival']['text2wave']} -F $frequency -o $fname.wav $fname.txt");
+ }
+ else
+ {
+ touch("$fname.txt");
+ touch("$fname.wav");
+ }
+
+ // stream it
+ $ret = $this->stream_file($fname, $escape_digits);
+
+ // clean up old files
+ $delete = time() - 2592000; // 1 month
+ foreach(glob($this->config['phpagi']['tempdir'] . DIRECTORY_SEPARATOR . 'text2wav_*') as $file)
+ if(filemtime($file) < $delete)
+ unlink($file);
+
+ return $ret;
+ }
+
+ /**
+ * Use Cepstral Swift to read text.
+ *
+ * @link http://www.cepstral.com/
+ * @param string $text
+ * @param string $escape_digits
+ * @param integer $frequency
+ * @return array, see evaluate for return information.
+ */
+ function swift($text, $escape_digits='', $frequency=8000, $voice=NULL)
+ {
+ if(!is_null($voice))
+ $voice = "-n $voice";
+ elseif(isset($this->config['cepstral']['voice']))
+ $voice = "-n {$this->config['cepstral']['voice']}";
+
+ $text = trim($text);
+ if($text == '') return true;
+
+ $hash = md5($text);
+ $fname = $this->config['phpagi']['tempdir'] . DIRECTORY_SEPARATOR;
+ $fname .= 'swift_' . $hash;
+
+ // create wave file
+ if(!file_exists("$fname.wav"))
+ {
+ // write text file
+ if(!file_exists("$fname.txt"))
+ {
+ $fp = fopen("$fname.txt", 'w');
+ fputs($fp, $text);
+ fclose($fp);
+ }
+
+ shell_exec("{$this->config['cepstral']['swift']} -p audio/channels=1,audio/sampling-rate=$frequency $voice -o $fname.wav -f $fname.txt");
+ }
+
+ // stream it
+ $ret = $this->stream_file($fname, $escape_digits);
+
+ // clean up old files
+ $delete = time() - 2592000; // 1 month
+ foreach(glob($this->config['phpagi']['tempdir'] . DIRECTORY_SEPARATOR . 'swift_*') as $file)
+ if(filemtime($file) < $delete)
+ unlink($file);
+
+ return $ret;
+ }
+
+ /**
+ * Text Input.
+ *
+ * Based on ideas found at http://www.voip-info.org/wiki-Asterisk+cmd+DTMFToText
+ *
+ * Example:
+ * UC H LC i , SP h o w SP a r e SP y o u ?
+ * $string = '*8'.'44*'.'*5'.'444*'.'00*'.'0*'.'44*'.'666*'.'9*'.'0*'.'2*'.'777*'.'33*'.'0*'.'999*'.'666*'.'88*'.'0000*';
+ *
+ * @link http://www.voip-info.org/wiki-Asterisk+cmd+DTMFToText
+ * @example examples/input.php Get text input from the user and say it back
+ *
+ * @return string
+ */
+ function text_input($mode='NUMERIC')
+ {
+ $alpha = array( 'k0'=>' ', 'k00'=>',', 'k000'=>'.', 'k0000'=>'?', 'k00000'=>'0',
+ 'k1'=>'!', 'k11'=>':', 'k111'=>';', 'k1111'=>'#', 'k11111'=>'1',
+ 'k2'=>'A', 'k22'=>'B', 'k222'=>'C', 'k2222'=>'2',
+ 'k3'=>'D', 'k33'=>'E', 'k333'=>'F', 'k3333'=>'3',
+ 'k4'=>'G', 'k44'=>'H', 'k444'=>'I', 'k4444'=>'4',
+ 'k5'=>'J', 'k55'=>'K', 'k555'=>'L', 'k5555'=>'5',
+ 'k6'=>'M', 'k66'=>'N', 'k666'=>'O', 'k6666'=>'6',
+ 'k7'=>'P', 'k77'=>'Q', 'k777'=>'R', 'k7777'=>'S', 'k77777'=>'7',
+ 'k8'=>'T', 'k88'=>'U', 'k888'=>'V', 'k8888'=>'8',
+ 'k9'=>'W', 'k99'=>'X', 'k999'=>'Y', 'k9999'=>'Z', 'k99999'=>'9');
+ $symbol = array('k0'=>'=',
+ 'k1'=>'<', 'k11'=>'(', 'k111'=>'[', 'k1111'=>'{', 'k11111'=>'1',
+ 'k2'=>'@', 'k22'=>'$', 'k222'=>'&', 'k2222'=>'%', 'k22222'=>'2',
+ 'k3'=>'>', 'k33'=>')', 'k333'=>']', 'k3333'=>'}', 'k33333'=>'3',
+ 'k4'=>'+', 'k44'=>'-', 'k444'=>'*', 'k4444'=>'/', 'k44444'=>'4',
+ 'k5'=>"'", 'k55'=>'`', 'k555'=>'5',
+ 'k6'=>'"', 'k66'=>'6',
+ 'k7'=>'^', 'k77'=>'7',
+ 'k8'=>"\\",'k88'=>'|', 'k888'=>'8',
+ 'k9'=>'_', 'k99'=>'~', 'k999'=>'9');
+ $text = '';
+ do
+ {
+ $command = false;
+ $result = $this->get_data('beep');
+ foreach(explode('*', $result['result']) as $code)
+ {
+ if($command)
+ {
+ switch($code{0})
+ {
+ case '2': $text = substr($text, 0, strlen($text) - 1); break; // backspace
+ case '5': $mode = 'LOWERCASE'; break;
+ case '6': $mode = 'NUMERIC'; break;
+ case '7': $mode = 'SYMBOL'; break;
+ case '8': $mode = 'UPPERCASE'; break;
+ case '9': $text = explode(' ', $text); unset($text[count($text)-1]); $text = join(' ', $text); break; // backspace a word
+ }
+ $code = substr($code, 1);
+ $command = false;
+ }
+ if($code == '')
+ $command = true;
+ elseif($mode == 'NUMERIC')
+ $text .= $code;
+ elseif($mode == 'UPPERCASE' && isset($alpha['k'.$code]))
+ $text .= $alpha['k'.$code];
+ elseif($mode == 'LOWERCASE' && isset($alpha['k'.$code]))
+ $text .= strtolower($alpha['k'.$code]);
+ elseif($mode == 'SYMBOL' && isset($symbol['k'.$code]))
+ $text .= $symbol['k'.$code];
+ }
+ $this->say_punctuation($text);
+ } while(substr($result['result'], -2) == '**');
+ return $text;
+ }
+
+ /**
+ * Say Puncutation in a string.
+ *
+ * @param string $text
+ * @param string $escape_digits
+ * @param integer $frequency
+ * @return array, see evaluate for return information.
+ */
+ function say_punctuation($text, $escape_digits='', $frequency=8000)
+ {
+ for($i = 0; $i < strlen($text); $i++)
+ {
+ switch($text{$i})
+ {
+ case ' ': $ret .= 'SPACE ';
+ case ',': $ret .= 'COMMA '; break;
+ case '.': $ret .= 'PERIOD '; break;
+ case '?': $ret .= 'QUESTION MARK '; break;
+ case '!': $ret .= 'EXPLANATION POINT '; break;
+ case ':': $ret .= 'COLON '; break;
+ case ';': $ret .= 'SEMICOLON '; break;
+ case '#': $ret .= 'POUND '; break;
+ case '=': $ret .= 'EQUALS '; break;
+ case '<': $ret .= 'LESS THAN '; break;
+ case '(': $ret .= 'LEFT PARENTHESIS '; break;
+ case '[': $ret .= 'LEFT BRACKET '; break;
+ case '{': $ret .= 'LEFT BRACE '; break;
+ case '@': $ret .= 'AT '; break;
+ case '$': $ret .= 'DOLLAR SIGN '; break;
+ case '&': $ret .= 'AMPERSAND '; break;
+ case '%': $ret .= 'PERCENT '; break;
+ case '>': $ret .= 'GREATER THAN '; break;
+ case ')': $ret .= 'RIGHT PARENTHESIS '; break;
+ case ']': $ret .= 'RIGHT BRACKET '; break;
+ case '}': $ret .= 'RIGHT BRACE '; break;
+ case '+': $ret .= 'PLUS '; break;
+ case '-': $ret .= 'MINUS '; break;
+ case '*': $ret .= 'ASTERISK '; break;
+ case '/': $ret .= 'SLASH '; break;
+ case "'": $ret .= 'SINGLE QUOTE '; break;
+ case '`': $ret .= 'BACK TICK '; break;
+ case '"': $ret .= 'QUOTE '; break;
+ case '^': $ret .= 'CAROT '; break;
+ case "\\": $ret .= 'BACK SLASH '; break;
+ case '|': $ret .= 'BAR '; break;
+ case '_': $ret .= 'UNDERSCORE '; break;
+ case '~': $ret .= 'TILDE '; break;
+ default: $ret .= $text{$i} . ' '; break;
+ }
+ }
+ return $this->text2wav($ret, $escape_digits, $frequency);
+ }
+
+ /**
+ * Create a new AGI_AsteriskManager.
+ */
+ function &new_AsteriskManager()
+ {
+ $this->asm = new AGI_AsteriskManager(NULL, $this->config);
+ $this->asm->pagi =& $this;
+ $this->config =& $this->asm->config;
+ return $this->asm;
+ }
+
+
+ // *********************************************************************************************************
+ // ** PRIVATE **
+ // *********************************************************************************************************
+
+
+ /**
+ * Evaluate an AGI command.
+ *
+ * @access private
+ * @param string $command
+ * @return array ('code'=>$code, 'result'=>$result, 'data'=>$data)
+ */
+ function evaluate($command)
+ {
+ $broken = array('code'=>500, 'result'=>-1, 'data'=>'');
+
+ // write command
+ if(!@fwrite($this->out, trim($command) . "\n")) return $broken;
+ fflush($this->out);
+
+ // Read result. Occasionally, a command return a string followed by an extra new line.
+ // When this happens, our script will ignore the new line, but it will still be in the
+ // buffer. So, if we get a blank line, it is probably the result of a previous
+ // command. We read until we get a valid result or asterisk hangs up. One offending
+ // command is SEND TEXT.
+ $count = 0;
+ do
+ {
+ $str = trim(fgets($this->in, 4096));
+ } while($str == '' && $count++ < 5);
+
+/*
+ PATCH
+*/
+ logthis("AGI EVALUATE '$command' returned: '$str' in $count reads");
+
+ if($count >= 5)
+ {
+// $this->conlog("evaluate error on read for $command");
+ return $broken;
+ }
+
+ // parse result
+ $ret['code'] = substr($str, 0, 3);
+ $str = trim(substr($str, 3));
+
+ if($str{0} == '-') // we have a multiline response!
+ {
+ $count = 0;
+ $str = substr($str, 1) . "\n";
+ $line = fgets($this->in, 4096);
+ while(substr($line, 0, 3) != $ret['code'] && $count < 5)
+ {
+ $str .= $line;
+ $line = fgets($this->in, 4096);
+ $count = (trim($line) == '') ? $count + 1 : 0;
+ }
+ if($count >= 5)
+ {
+// $this->conlog("evaluate error on multiline read for $command");
+ return $broken;
+ }
+ }
+
+ $ret['result'] = NULL;
+ $ret['data'] = '';
+ if($ret['code'] != AGIRES_OK) // some sort of error
+ {
+ $ret['data'] = $str;
+ $this->conlog(print_r($ret, true));
+ }
+ else // normal AGIRES_OK response
+ {
+ $parse = explode(' ', trim($str));
+ $in_token = false;
+ foreach($parse as $token)
+ {
+ if($in_token) // we previously hit a token starting with ')' but not ending in ')'
+ {
+ $ret['data'] .= ' ' . trim($token, '() ');
+ if($token{strlen($token)-1} == ')') $in_token = false;
+ }
+ elseif($token{0} == '(')
+ {
+ if($token{strlen($token)-1} != ')') $in_token = true;
+ $ret['data'] .= ' ' . trim($token, '() ');
+ }
+ elseif(strpos($token, '='))
+ {
+ $token = explode('=', $token);
+ $ret[$token[0]] = $token[1];
+ }
+ elseif($token != '')
+ $ret['data'] .= ' ' . $token;
+ }
+ $ret['data'] = trim($ret['data']);
+ }
+
+ // log some errors
+ if($ret['result'] < 0)
+ $this->conlog("$command returned {$ret['result']}");
+
+ return $ret;
+ }
+
+ /**
+ * Log to console if debug mode.
+ *
+ * @example examples/ping.php Ping an IP address
+ *
+ * @param string $str
+ * @param integer $vbl verbose level
+ */
+ function conlog($str, $vbl=1)
+ {
+ static $busy = false;
+
+ if($this->config['phpagi']['debug'] != false)
+ {
+ if(!$busy) // no conlogs inside conlog!!!
+ {
+ $busy = true;
+ $this->verbose($str, $vbl);
+ $busy = false;
+ }
+ }
+ }
+
+ /**
+ * Find an execuable in the path.
+ *
+ * @access private
+ * @param string $cmd command to find
+ * @param string $checkpath path to check
+ * @return string the path to the command
+ */
+ function which($cmd, $checkpath=NULL)
+ {
+ global $_ENV;
+ $chpath = is_null($checkpath) ? $_ENV['PATH'] : $checkpath;
+
+ foreach(explode(':', $chpath) as $path)
+ if(is_executable("$path/$cmd"))
+ return "$path/$cmd";
+
+ if(is_null($checkpath))
+ return $this->which($cmd, '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:'.
+ '/usr/X11R6/bin:/usr/local/apache/bin:/usr/local/mysql/bin');
+ return false;
+ }
+
+ /**
+ * Make a folder recursively.
+ *
+ * @access private
+ * @param string $folder
+ * @param integer $perms
+ */
+ function make_folder($folder, $perms=0755)
+ {
+ $f = explode(DIRECTORY_SEPARATOR, $folder);
+ $base = '';
+ for($i = 0; $i < count($f); $i++)
+ {
+ $base .= $f[$i];
+ if($f[$i] != '' && !file_exists($base))
+ mkdir($base, $perms);
+ $base .= DIRECTORY_SEPARATOR;
+ }
+ }
+ }
+
+/**
+ * error handler for phpagi.
+ *
+ * @param integer $level PHP error level
+ * @param string $message error message
+ * @param string $file path to file
+ * @param integer $line line number of error
+ * @param array $context variables in the current scope
+ */
+ function phpagi_error_handler($level, $message, $file, $line, $context)
+ {
+ if(ini_get('error_reporting') == 0) return; // this happens with an @
+
+ @syslog(LOG_WARNING, $file . '[' . $line . ']: ' . $message);
+
+ global $phpagi_error_handler_email;
+ if(function_exists('mail') && !is_null($phpagi_error_handler_email)) // generate email debugging information
+ {
+ // decode error level
+ switch($level)
+ {
+ case E_WARNING:
+ case E_USER_WARNING:
+ $level = "Warning";
+ break;
+ case E_NOTICE:
+ case E_USER_NOTICE:
+ $level = "Notice";
+ break;
+ case E_USER_ERROR:
+ $level = "Error";
+ break;
+ }
+
+ // build message
+ $basefile = basename($file);
+ $subject = "$basefile/$line/$level: $message";
+ $message = "$level: $message in $file on line $line\n\n";
+
+ if(function_exists('mysql_errno') && strpos(' '.strtolower($message), 'mysql'))
+ $message .= 'MySQL error ' . mysql_errno() . ": " . mysql_error() . "\n\n";
+
+ // figure out who we are
+ if(function_exists('socket_create'))
+ {
+ $addr = NULL;
+ $port = 80;
+ $socket = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
+ @socket_connect($socket, '64.0.0.0', $port);
+ @socket_getsockname($socket, $addr, $port);
+ @socket_close($socket);
+ $message .= "\n\nIP Address: $addr\n";
+ }
+
+ // include variables
+ $message .= "\n\nContext:\n" . print_r($context, true);
+ $message .= "\n\nGLOBALS:\n" . print_r($GLOBALS, true);
+ $message .= "\n\nBacktrace:\n" . print_r(debug_backtrace(), true);
+
+ // include code fragment
+ if(file_exists($file))
+ {
+ $message .= "\n\n$file:\n";
+ $code = @file($file);
+ for($i = max(0, $line - 10); $i < min($line + 10, count($code)); $i++)
+ $message .= ($i + 1)."\t$code[$i]";
+ }
+
+ // make sure message is fully readable (convert unprintable chars to hex representation)
+ $ret = '';
+ for($i = 0; $i < strlen($message); $i++)
+ {
+ $c = ord($message{$i});
+ if($c == 10 || $c == 13 || $c == 9)
+ $ret .= $message{$i};
+ elseif($c < 16)
+ $ret .= '\x0' . dechex($c);
+ elseif($c < 32 || $c > 127)
+ $ret .= '\x' . dechex($c);
+ else
+ $ret .= $message{$i};
+ }
+ $message = $ret;
+
+ // send the mail if less than 5 errors
+ static $mailcount = 0;
+ if($mailcount < 5)
+ @mail($phpagi_error_handler_email, $subject, $message);
+ $mailcount++;
+ }
+ }
+ $phpagi_error_handler_email = NULL;
+?>
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/hunmonk/lua/support_functions_database.lua (from rev 15313, freeswitch/trunk/contrib/hunmonk/lua/support_functions_database.lua) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/hunmonk/lua/support_functions_database.lua (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/hunmonk/lua/support_functions_database.lua 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,28 @@
+--[[
+ Helper functions for database operations.
+]]
+
+--[[
+ Escapes special characters for the MySQL database.
+]]
+function mysql_escape(string_to_escape)
+ -- Single quote, double quote, backspace.
+ escaped_string, replacements = string.gsub(string_to_escape, "(['\"\\])", function(x) return "\\" .. x end)
+ -- Null byte.
+ escaped_string, replacements = string.gsub(escaped_string, "%z", "\\0")
+
+ return escaped_string
+end
+
+--[[
+ Escapes special characters for the Postgres database.
+]]
+function pgsql_escape(string_to_escape)
+ -- Single quote..
+ escaped_string, replacements = string.gsub(string_to_escape, "'", "''")
+ -- Null byte.
+ escaped_string, replacements = string.gsub(escaped_string, "%z", "")
+
+ return escaped_string
+end
+
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/easyroute.conf.php (from rev 15313, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/easyroute.conf.php) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/easyroute.conf.php (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/easyroute.conf.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,60 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * easyroute.conf.php
+ */
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Writes out easyroute.conf XML
+ * @see fs_configuration
+ */
+class easyroute_conf extends fs_configuration {
+ public function easyroute_conf() {
+ $this->fs_configuration();
+ }
+
+ public function main() {
+ $config = $this->get_config();
+ $this->write_config($config);
+ }
+
+ private function get_config() {
+ $query = sprintf('SELECT * FROM easyroute_conf');
+ $settings_array = $this -> db -> queryAll($query);
+ $settings_count = count($settings_array);
+ if (FS_PDO::isError($settings_array)) {
+ $this -> comment($query);
+ $this -> comment($this -> db -> getMessage());
+ return ;
+ }
+
+ return $settings_array;
+ }
+
+ private function write_config($settings_array) {
+ $this->xmlw->startElement('configuration');
+ $this->xmlw->writeAttribute('name', basename(__FILE__, '.php'));
+ $this->xmlw->writeAttribute('description', 'Dynamic ' . ucfirst(basename(__FILE__, '.conf.php')) . ' Configuration');
+ $this->xmlw->startElement('settings');
+ $settings_count = count($settings_array);
+ if ($settings_count > 0) {
+ for ($i=0; $i<$settings_count; $i++) {
+ $this->xmlw->startElement('param');
+ $this->xmlw->writeAttribute('name', $settings_array[$i]['param_name']);
+ $this->xmlw->writeAttribute('value', $settings_array[$i]['param_value']);
+ $this->xmlw->endElement();//</param>
+ }
+ }
+ $this->xmlw->endElement(); // </settings>
+ $this->xmlw->endElement();
+ }
+}
+
+
+
+?>
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/lcr.conf.php (from rev 15313, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/configuration/lcr.conf.php) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/lcr.conf.php (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/lcr.conf.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,104 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * lcr.conf.php
+ */
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman@gmail.com>
+ * @version 0.1
+ * Writes out lcr.conf XML
+ * @see fs_configuration
+ */
+class lcr_conf extends fs_configuration {
+ public function lcr_conf() {
+ $this->fs_configuration();
+ }
+
+ public function main() {
+ $this->write_config();
+ }
+
+ private function write_config() {
+
+ $this->xmlw->startElement('configuration');
+ $this->xmlw->writeAttribute('name', basename(__FILE__, '.php'));
+ $this->xmlw->writeAttribute('description', 'Dynamic ' . ucfirst(basename(__FILE__, '.conf.php')) . ' Configuration');
+
+ $this->xmlw->startElement('settings');
+ $query = sprintf('SELECT * FROM lcr_conf;');
+ $settings_array = $this -> db -> queryAll($query);
+ $settings_count = count($settings_array);
+ if (FS_PDO::isError($settings_array)) {
+ $this -> comment($query);
+ $this -> comment($this -> db -> getMessage());
+ return ;
+ }
+ for ($i = 0; $i < $settings_count; $i++) {
+ $this->xmlw->startElement('param');
+ $this->xmlw->writeAttribute('name', $settings_array[$i]['param_name']);
+ $this->xmlw->writeAttribute('value', $settings_array[$i]['param_value']);
+ $this->xmlw->endElement();
+ }
+ $this->xmlw->endElement(); // </settings>
+
+
+ $profiles = $this->get_profiles();
+ $this->write_profiles($profiles);
+
+ $this->xmlw->endElement(); // </configuration>
+ }
+
+ private function get_profiles() {
+ $query = sprintf(
+ 'SELECT *, lp.id AS lcr_id FROM lcr_profiles lp
+ LEFT JOIN lcr_settings ls ON ls.lcr_id = lp.id
+ ORDER BY lp.id;'
+ );
+ $settings_array = $this -> db -> queryAll($query);
+ $settings_count = count($settings_array);
+ if (FS_PDO::isError($settings_array)) {
+ $this -> comment($query);
+ $this -> comment($this -> db -> getMessage());
+ return ;
+ }
+
+ $settings = array();
+ for ($i = 0; $i < $settings_count; $i++) {
+ $profile = $settings_array[$i]['profile_name'];
+ $param = $settings_array[$i]['param_name'];
+ $settings[$profile]['id'] = $settings_array[$i]['lcr_id'];
+ $settings[$profile][$param] = $settings_array[$i]['param_value'];
+ }
+ return $settings;
+ }
+
+ private function write_profiles($settings_array) {
+ $this->xmlw->startElement('profiles');
+
+
+ foreach ($settings_array as $profile => $profile_data) {
+ $this->xmlw->startElement('profile');
+ $this->xmlw->writeAttribute('name', $profile);
+ $this->debug($profile_data);
+ foreach ($profile_data as $name => $value) {
+ if (!$name) {
+ continue;
+ }
+ $this->xmlw->startElement('param');
+ $this->xmlw->writeAttribute('name', $name);
+ $this->xmlw->writeAttribute('value', $value);
+ $this->xmlw->endElement();//</param>
+ }
+ $this->xmlw->endElement(); // </profile>
+ }
+
+
+
+ $this->xmlw->endElement(); // </profiles>
+ }
+}
+
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/post_load_modules.conf.php (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/post_load_modules.conf.php 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/post_load_modules.conf.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -32,7 +32,7 @@
*/
function get_modules_array() {
$query = sprintf(
- 'SELECT * FROM post_load_modules_conf WHERE load_module=1 ORDER BY priority;'
+ "SELECT * FROM post_load_modules_conf WHERE load_module='1' ORDER BY priority;"
);
$res = $this -> db -> query($query);
if (FS_PDO::isError($res)) {
@@ -40,7 +40,7 @@
$this -> comment($res -> getMessage());
return array();
}
- $this -> comment($res -> numRows() . 'rows');
+ $this -> comment($res -> numRows() . ' rows');
if ($res -> numRows() == 0) {
return array();
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/voicemail.conf.php (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/voicemail.conf.php 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/voicemail.conf.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1,7 +1,7 @@
<?php
/**
* @package FS_CURL
- * @subpackage FS_CURL_Directory
+ * @subpackage FS_CURL_Configuration
* voicemail.conf.php
*/
/**
@@ -12,10 +12,10 @@
* @version 0.1
* Writes out voicemail.conf XML
* @see fs_configuration
-*/
+ */
class voicemail_conf extends fs_configuration {
- public function voicemail_conf() {
+ public function voicemail_conf() {
$this -> fs_configuration();
}
@@ -27,7 +27,7 @@
/**
* Get voicemail profiles from db
* @return array
- */
+ */
private function get_profiles() {
$query = "SELECT * FROM voicemail_conf ORDER BY id";
$profiles = $this -> db -> queryAll($query);
@@ -37,12 +37,12 @@
/**
* Write XML for voicemail <settings>
* @return void
- */
+ */
private function write_settings($profile_id) {
$query = sprintf('%s %s %s;'
- , "SELECT * FROM voicemail_settings "
- , "WHERE voicemail_id=$profile_id "
- , "ORDER BY voicemail_id, param_name"
+ , "SELECT * FROM voicemail_settings "
+ , "WHERE voicemail_id=$profile_id "
+ , "ORDER BY voicemail_id, param_name"
);
$settings_array = $this -> db -> queryAll($query);
$settings_count = count($settings_array);
@@ -54,28 +54,26 @@
if ($settings_count < 1) {
return ;
}
- //$this -> xmlw -> startElement('settings');
for ($i=0; $i<$settings_count; $i++) {
- //$this -> comment_array($settings_array[$i]);
+ //$this -> comment_array($settings_array[$i]);
$this -> xmlw -> startElement('param');
$this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
$this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
$this -> xmlw -> endElement();//</param>
}
$this -> write_email($profile_id);
- //$this -> xmlw -> endElement();
}
/**
* Write XML for voicemail email settings
* @return void
- */
+ */
private function write_email($profile_id) {
$query = sprintf('%s %s %s;'
- , "SELECT * FROM voicemail_email "
- , "WHERE voicemail_id=$profile_id "
- , "ORDER BY voicemail_id, param_name"
+ , "SELECT * FROM voicemail_email "
+ , "WHERE voicemail_id=$profile_id "
+ , "ORDER BY voicemail_id, param_name"
);
$settings_array = $this -> db -> queryAll($query);
$settings_count = count($settings_array);
@@ -90,7 +88,7 @@
$this -> xmlw -> startElement('email');
for ($i=0; $i<$settings_count; $i++) {
- //$this -> comment_array($settings_array[$i]);
+ //$this -> comment_array($settings_array[$i]);
$this -> xmlw -> startElement('param');
$this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
$this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
@@ -102,7 +100,7 @@
/**
* Write the XML for the current profile in write_profiles
* @return void
- */
+ */
private function write_single_profile($profile) {
$this -> xmlw -> startElement('profile');
$this -> xmlw -> writeAttribute('name', $profile['vm_profile']);
@@ -114,7 +112,7 @@
* Write the entire XML config for the voicemail module
* Write XML by calling other methods to do specific areas of config
* @return void
- */
+ */
private function write_config($profiles) {
$profile_count = count($profiles);
$this -> xmlw -> startElement('configuration');
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/xml_cdr.conf.php (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/xml_cdr.conf.php 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/configuration/xml_cdr.conf.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -14,35 +14,34 @@
*/
class xml_cdr_conf extends fs_configuration {
function xml_cdr_conf() {
- $this -> fs_configuration();
+ $this->fs_configuration();
}
function main() {
- $params = $this -> get_settings();
- $this -> write_settings($params);
+ $params = $this->get_settings();
+ $this->write_settings($params);
}
function get_settings() {
- return array('url'=>'http://$${curl_host}/fs_curl/cdr.php', 'encode'=>'true');
return array(
- 'url'=>'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']
+ 'url'=>'http://' . $_SERVER['HTTP_HOST'] . '/' . $_SERVER['PHP_SELF']
, 'encode'=>'true'
);
}
function write_settings($params) {
- $this -> xmlw -> startElement('configuration');
- $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
- $this -> xmlw -> writeAttribute('description', 'CDRs via XML Post');
- $this -> xmlw -> startElement('settings');
+ $this->xmlw->startElement('configuration');
+ $this->xmlw->writeAttribute('name', basename(__FILE__, '.php'));
+ $this->xmlw->writeAttribute('description', 'CDRs via XML Post');
+ $this->xmlw->startElement('settings');
while (list($name, $value) = each($params)) {
- $this -> xmlw -> startElement('param');
- $this -> xmlw -> writeAttribute('name', $name);
- $this -> xmlw -> writeAttribute('value', $value);
- $this -> xmlw -> endElement();
+ $this->xmlw->startElement('param');
+ $this->xmlw->writeAttribute('name', $name);
+ $this->xmlw->writeAttribute('value', $value);
+ $this->xmlw->endElement();
}
- $this -> xmlw -> endElement();
- $this -> xmlw -> endElement();
+ $this->xmlw->endElement();
+ $this->xmlw->endElement();
}
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/fs_configuration.php (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/fs_configuration.php 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/fs_configuration.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -23,7 +23,9 @@
*/
function fs_configuration() {
$this -> fs_curl();
- $mod_name = sprintf('mod_%s', str_replace('.conf', '', $this -> request['key_value']));
+ $conf_file = $this->request['key_value'];
+ $this->debug("RECEIVED REQUEST FOR $conf_file");
+ $mod_name = sprintf('mod_%s', str_replace('.conf', '', $conf_file));
$this -> comment("module name is $mod_name");
if (!($this -> is_mod_enabled($mod_name))
&& !($this -> is_modless_conf($this -> request['key_value']))) {
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/fs_curl.php (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/fs_curl.php 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/fs_curl.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -80,7 +80,7 @@
case 'mysql':
$quoter = '`';
break;
- case 'postgres':
+ case 'pgsql':
$quoter = '"';
break;
default:
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/fs_directory.php (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/fs_directory.php 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/fs_directory.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -49,7 +49,10 @@
SET %1$sparam_value%1$s = \'%2$s\'
WHERE %1$sparam_name%1$s = \'vm-password\'
AND %1$sdirectory_id%1$s =
- (SELECT %1$sid%1$s FROM %1$sdirectory%1$s WHERE %1$susername%1$s = \'%3$s\' AND %1$sdomain%1$s = \'%4$s\')'
+ (SELECT %1$sid%1$s
+ 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']
);
$this->debug($query);
@@ -64,6 +67,7 @@
*/
private function get_directory() {
$directory_array = array();
+ $join_clause = '';
if (!array_key_exists('domain', $this -> request)) {
$this -> comment('domain not passed');
$this -> file_not_found();
@@ -74,6 +78,11 @@
if (array_key_exists('user', $this -> request)) {
$where_array[] = sprintf("username='%s'", $this -> user);
}
+ if (array_key_exists('group', $this->request)) {
+ $where_array[] = sprintf("group_name='%s'", $this->request['group']);
+ $join_clause = "JOIN directory_group_user_map dgum ON d.id=dgum.user_id ";
+ $join_clause .= "JOIN directory_groups dg ON dgum.group_id=dg.group_id ";
+ }
if (!empty($where_array)) {
$this -> comment('where array has contents');
if (count($where_array) > 1) {
@@ -84,9 +93,10 @@
} else {
$where_clause = '';
}
- $query = sprintf("SELECT * FROM directory %s ORDER BY username"
- , $where_clause
+ $query = sprintf("SELECT * FROM directory d %s %s ORDER BY username"
+ , $join_clause, $where_clause
);
+ $this->debug($query);
$res = $this -> db -> queryAll($query);
if (FS_PDO::isError($res)) {
$this -> comment($query);
@@ -133,7 +143,8 @@
* @return void
*/
private function write_params($user_id) {
- if (is_array($this->users_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) {
$this -> xmlw -> startElement('params');
foreach($this->users_params[$user_id] as $pname => $pvalue) {
@@ -219,7 +230,8 @@
* @return void
*/
private function write_gateways($user_id) {
- if (array_key_exists($user_id, $this->users_gateways)
+ if (is_array($this->users_gateways)
+ && 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]);
@@ -296,6 +308,9 @@
$param_count = count($res);
$this -> xmlw -> startElement('params');
for ($i=0; $i<$param_count; $i++) {
+ if (empty($res[$i]['param_name'])) {
+ continue;
+ }
$this -> xmlw -> startElement('param');
$this -> xmlw -> writeAttribute('name', $res[$i]['param_name']);
$this -> xmlw -> writeAttribute('value', $res[$i]['param_value']);
@@ -325,6 +340,9 @@
$param_count = count($res);
$this -> xmlw -> startElement('variables');
for ($i=0; $i<$param_count; $i++) {
+ if (empty($res[$i]['var_name'])) {
+ continue;
+ }
$this -> xmlw -> startElement('variable');
$this -> xmlw -> writeAttribute('name', $res[$i]['var_name']);
$this -> xmlw -> writeAttribute('value', $res[$i]['var_value']);
@@ -359,17 +377,30 @@
$this -> write_global_params();
$this -> write_global_vars();
+ $this->xmlw->startElement('groups');
+ $this->xmlw->startElement('group');
+ if (array_key_exists('group', $this->request)) {
+ $this->xmlw->writeAttribute('name', $this->request['group']);
+ } else {
+ $this->xmlw->writeAttribute('name', 'default');
+ }
+ $this->xmlw->startElement('users');
for ($i=0; $i<$directory_count; $i++) {
$username = $directory[$i]['username'];
$mailbox = empty($directory[$i]['mailbox']) ? $username : $directory[$i]['mailbox'];
$this -> xmlw -> startElement('user');
$this -> xmlw -> writeAttribute('id', $username);
- $this -> xmlw -> writeAttribute('mailbox', $mailbox);
- $this -> write_params($directory[$i]['id']);
- $this -> write_variables($directory[$i]['id']);
- $this -> write_gateways($directory[$i]['id']);
+ 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 -> xmlw -> endElement();
}
+ $this->xmlw->endElement();
+ $this->xmlw->endElement();
$this -> xmlw -> endElement();
$this -> xmlw -> endElement();
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/global_defines.php (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/global_defines.php 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/global_defines.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -13,7 +13,7 @@
/**
* Defines the default dsn for the FS_PDO class
*/
-define('DEFAULT_DSN', 'mysql:dbname=freeswitch;host=127.0.0.1');
+define('DEFAULT_DSN', 'pgsql:dbname=freeswitch;host=127.0.0.1');
/**
* Defines the default dsn login for the PDO class
*/
@@ -63,7 +63,7 @@
* 1 xml comment
* 2 file (named in FS_DEBUG_FILE), take care when using this option as there's currently nothing to watch the file's size
*/
-define('FS_DEBUG_TYPE', 1);
+define('FS_DEBUG_TYPE', 0);
/**
* File to use for debugging to file
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/sql/postgres-8.4.sql (from rev 15313, freeswitch/trunk/contrib/intralanman/PHP/fs_curl/sql/postgres-8.4.sql) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/sql/postgres-8.4.sql (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_curl/sql/postgres-8.4.sql 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,3574 @@
+--
+-- PostgreSQL database dump
+--
+
+SET statement_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = off;
+SET check_function_bodies = false;
+SET client_min_messages = warning;
+SET escape_string_warning = off;
+
+--
+-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
+--
+
+CREATE PROCEDURAL LANGUAGE plpgsql;
+
+
+ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;
+
+SET search_path = public, pg_catalog;
+
+SET default_tablespace = '';
+
+SET default_with_oids = false;
+
+--
+-- Name: accounts; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE accounts (
+ id bigint NOT NULL,
+ name character varying(256),
+ cash double precision NOT NULL
+);
+
+
+ALTER TABLE public.accounts OWNER TO freeswitch;
+
+--
+-- Name: accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE accounts_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.accounts_id_seq OWNER TO freeswitch;
+
+--
+-- Name: accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE accounts_id_seq OWNED BY accounts.id;
+
+
+--
+-- Name: acl_lists; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE acl_lists (
+ id integer NOT NULL,
+ acl_name character varying(128) NOT NULL,
+ default_policy character varying(48) NOT NULL
+);
+
+
+ALTER TABLE public.acl_lists OWNER TO freeswitch;
+
+--
+-- Name: acl_lists_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE acl_lists_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.acl_lists_id_seq OWNER TO freeswitch;
+
+--
+-- Name: acl_lists_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE acl_lists_id_seq OWNED BY acl_lists.id;
+
+
+--
+-- Name: acl_nodes; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE acl_nodes (
+ id integer NOT NULL,
+ cidr character varying(48) NOT NULL,
+ type character varying(16) NOT NULL,
+ list_id integer NOT NULL
+);
+
+
+ALTER TABLE public.acl_nodes OWNER TO freeswitch;
+
+--
+-- Name: acl_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE acl_nodes_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.acl_nodes_id_seq OWNER TO freeswitch;
+
+--
+-- Name: acl_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE acl_nodes_id_seq OWNED BY acl_nodes.id;
+
+
+--
+-- Name: carrier_gateway; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE carrier_gateway (
+ id integer NOT NULL,
+ carrier_id integer,
+ prefix character varying(128) DEFAULT ''::character varying NOT NULL,
+ suffix character varying(128) DEFAULT ''::character varying NOT NULL,
+ codec character varying(128) DEFAULT ''::character varying NOT NULL,
+ enabled boolean DEFAULT true NOT NULL
+);
+
+
+ALTER TABLE public.carrier_gateway OWNER TO freeswitch;
+
+--
+-- Name: carrier_gateway_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE carrier_gateway_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.carrier_gateway_id_seq OWNER TO freeswitch;
+
+--
+-- Name: carrier_gateway_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE carrier_gateway_id_seq OWNED BY carrier_gateway.id;
+
+
+--
+-- Name: carriers; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE carriers (
+ id integer NOT NULL,
+ carrier_name character varying(255) NOT NULL,
+ enabled boolean DEFAULT true NOT NULL
+);
+
+
+ALTER TABLE public.carriers OWNER TO freeswitch;
+
+--
+-- Name: carriers_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE carriers_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.carriers_id_seq OWNER TO freeswitch;
+
+--
+-- Name: carriers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE carriers_id_seq OWNED BY carriers.id;
+
+
+--
+-- Name: conference_advertise; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE conference_advertise (
+ id integer NOT NULL,
+ room character varying(64) NOT NULL,
+ status character varying(128) NOT NULL
+);
+
+
+ALTER TABLE public.conference_advertise OWNER TO freeswitch;
+
+--
+-- Name: conference_advertise_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE conference_advertise_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.conference_advertise_id_seq OWNER TO freeswitch;
+
+--
+-- Name: conference_advertise_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE conference_advertise_id_seq OWNED BY conference_advertise.id;
+
+
+--
+-- Name: conference_controls; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE conference_controls (
+ id integer NOT NULL,
+ conf_group character varying(64) NOT NULL,
+ action character varying(64) NOT NULL,
+ digits character varying(16) NOT NULL
+);
+
+
+ALTER TABLE public.conference_controls OWNER TO freeswitch;
+
+--
+-- Name: conference_controls_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE conference_controls_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.conference_controls_id_seq OWNER TO freeswitch;
+
+--
+-- Name: conference_controls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE conference_controls_id_seq OWNED BY conference_controls.id;
+
+
+--
+-- Name: conference_profiles; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE conference_profiles (
+ id integer NOT NULL,
+ profile_name character varying(64) NOT NULL,
+ param_name character varying(64) NOT NULL,
+ param_value character varying(64) NOT NULL
+);
+
+
+ALTER TABLE public.conference_profiles OWNER TO freeswitch;
+
+--
+-- Name: conference_profiles_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE conference_profiles_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.conference_profiles_id_seq OWNER TO freeswitch;
+
+--
+-- Name: conference_profiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE conference_profiles_id_seq OWNED BY conference_profiles.id;
+
+
+--
+-- Name: dialplan; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE dialplan (
+ dialplan_id integer NOT NULL,
+ domain character varying(128) NOT NULL,
+ ip_address character varying(16) NOT NULL
+);
+
+
+ALTER TABLE public.dialplan OWNER TO freeswitch;
+
+--
+-- Name: dialplan_actions; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE dialplan_actions (
+ action_id integer NOT NULL,
+ condition_id integer NOT NULL,
+ application character varying(256) NOT NULL,
+ data character varying(256) NOT NULL,
+ type character varying(32) NOT NULL,
+ weight integer NOT NULL
+);
+
+
+ALTER TABLE public.dialplan_actions OWNER TO freeswitch;
+
+--
+-- Name: dialplan_actions_action_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE dialplan_actions_action_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.dialplan_actions_action_id_seq OWNER TO freeswitch;
+
+--
+-- Name: dialplan_actions_action_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE dialplan_actions_action_id_seq OWNED BY dialplan_actions.action_id;
+
+
+--
+-- Name: dialplan_condition; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE dialplan_condition (
+ condition_id integer NOT NULL,
+ extension_id integer NOT NULL,
+ field character varying(128) NOT NULL,
+ expression character varying(128) NOT NULL,
+ weight integer NOT NULL
+);
+
+
+ALTER TABLE public.dialplan_condition OWNER TO freeswitch;
+
+--
+-- Name: dialplan_condition_condition_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE dialplan_condition_condition_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.dialplan_condition_condition_id_seq OWNER TO freeswitch;
+
+--
+-- Name: dialplan_condition_condition_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE dialplan_condition_condition_id_seq OWNED BY dialplan_condition.condition_id;
+
+
+--
+-- Name: dialplan_context; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE dialplan_context (
+ context_id integer NOT NULL,
+ dialplan_id integer NOT NULL,
+ context character varying(64) NOT NULL,
+ weight integer NOT NULL
+);
+
+
+ALTER TABLE public.dialplan_context OWNER TO freeswitch;
+
+--
+-- Name: dialplan_context_context_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE dialplan_context_context_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.dialplan_context_context_id_seq OWNER TO freeswitch;
+
+--
+-- Name: dialplan_context_context_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE dialplan_context_context_id_seq OWNED BY dialplan_context.context_id;
+
+
+--
+-- Name: dialplan_dialplan_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE dialplan_dialplan_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.dialplan_dialplan_id_seq OWNER TO freeswitch;
+
+--
+-- Name: dialplan_dialplan_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE dialplan_dialplan_id_seq OWNED BY dialplan.dialplan_id;
+
+
+--
+-- Name: dialplan_extension; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE dialplan_extension (
+ extension_id integer NOT NULL,
+ context_id integer NOT NULL,
+ name character varying(128) NOT NULL,
+ continue character varying(32) NOT NULL,
+ weight integer NOT NULL
+);
+
+
+ALTER TABLE public.dialplan_extension OWNER TO freeswitch;
+
+--
+-- Name: dialplan_extension_extension_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE dialplan_extension_extension_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.dialplan_extension_extension_id_seq OWNER TO freeswitch;
+
+--
+-- Name: dialplan_extension_extension_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE dialplan_extension_extension_id_seq OWNED BY dialplan_extension.extension_id;
+
+
+--
+-- Name: dialplan_special; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE dialplan_special (
+ id integer NOT NULL,
+ context character varying(256) NOT NULL,
+ class_file character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.dialplan_special OWNER TO freeswitch;
+
+--
+-- Name: dialplan_special_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE dialplan_special_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.dialplan_special_id_seq OWNER TO freeswitch;
+
+--
+-- Name: dialplan_special_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE dialplan_special_id_seq OWNED BY dialplan_special.id;
+
+
+--
+-- Name: dingaling_profile_params; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE dingaling_profile_params (
+ id integer NOT NULL,
+ dingaling_id integer NOT NULL,
+ param_name character varying(64) NOT NULL,
+ param_value character varying(64) NOT NULL
+);
+
+
+ALTER TABLE public.dingaling_profile_params OWNER TO freeswitch;
+
+--
+-- Name: dingaling_profile_params_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE dingaling_profile_params_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.dingaling_profile_params_id_seq OWNER TO freeswitch;
+
+--
+-- Name: dingaling_profile_params_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE dingaling_profile_params_id_seq OWNED BY dingaling_profile_params.id;
+
+
+--
+-- Name: dingaling_profiles; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE dingaling_profiles (
+ id integer NOT NULL,
+ profile_name character varying(64) NOT NULL,
+ type character varying(64) NOT NULL
+);
+
+
+ALTER TABLE public.dingaling_profiles OWNER TO freeswitch;
+
+--
+-- Name: dingaling_profiles_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE dingaling_profiles_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.dingaling_profiles_id_seq OWNER TO freeswitch;
+
+--
+-- Name: dingaling_profiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE dingaling_profiles_id_seq OWNED BY dingaling_profiles.id;
+
+
+--
+-- Name: dingaling_settings; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE dingaling_settings (
+ id integer NOT NULL,
+ param_name character varying(64) NOT NULL,
+ param_value character varying(64) NOT NULL
+);
+
+
+ALTER TABLE public.dingaling_settings OWNER TO freeswitch;
+
+--
+-- Name: dingaling_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE dingaling_settings_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.dingaling_settings_id_seq OWNER TO freeswitch;
+
+--
+-- Name: dingaling_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE dingaling_settings_id_seq OWNED BY dingaling_settings.id;
+
+
+--
+-- Name: directory; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE directory (
+ id integer NOT NULL,
+ username character varying(256) NOT NULL,
+ domain character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.directory OWNER TO freeswitch;
+
+--
+-- Name: directory_domains; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE directory_domains (
+ id integer NOT NULL,
+ domain_name character varying(128) NOT NULL
+);
+
+
+ALTER TABLE public.directory_domains OWNER TO freeswitch;
+
+--
+-- Name: directory_domains_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE directory_domains_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.directory_domains_id_seq OWNER TO freeswitch;
+
+--
+-- Name: directory_domains_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE directory_domains_id_seq OWNED BY directory_domains.id;
+
+
+--
+-- Name: directory_gateway_params; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE directory_gateway_params (
+ id integer NOT NULL,
+ d_gw_id integer NOT NULL,
+ param_name character varying(64) NOT NULL,
+ param_value character varying(64) NOT NULL
+);
+
+
+ALTER TABLE public.directory_gateway_params OWNER TO freeswitch;
+
+--
+-- Name: directory_gateway_params_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE directory_gateway_params_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.directory_gateway_params_id_seq OWNER TO freeswitch;
+
+--
+-- Name: directory_gateway_params_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE directory_gateway_params_id_seq OWNED BY directory_gateway_params.id;
+
+
+--
+-- Name: directory_gateways; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE directory_gateways (
+ id integer NOT NULL,
+ directory_id integer NOT NULL,
+ gateway_name character varying(128) NOT NULL
+);
+
+
+ALTER TABLE public.directory_gateways OWNER TO freeswitch;
+
+--
+-- Name: directory_gateways_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE directory_gateways_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.directory_gateways_id_seq OWNER TO freeswitch;
+
+--
+-- Name: directory_gateways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE directory_gateways_id_seq OWNED BY directory_gateways.id;
+
+
+--
+-- Name: directory_global_params; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE directory_global_params (
+ id integer NOT NULL,
+ param_name character varying(64) NOT NULL,
+ param_value character varying(128) NOT NULL,
+ domain_id integer NOT NULL
+);
+
+
+ALTER TABLE public.directory_global_params OWNER TO freeswitch;
+
+--
+-- Name: directory_global_params_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE directory_global_params_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.directory_global_params_id_seq OWNER TO freeswitch;
+
+--
+-- Name: directory_global_params_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE directory_global_params_id_seq OWNED BY directory_global_params.id;
+
+
+--
+-- Name: directory_global_vars; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE directory_global_vars (
+ id integer NOT NULL,
+ var_name character varying(64) NOT NULL,
+ var_value character varying(128) NOT NULL,
+ domain_id integer NOT NULL
+);
+
+
+ALTER TABLE public.directory_global_vars OWNER TO freeswitch;
+
+--
+-- Name: directory_global_vars_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE directory_global_vars_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.directory_global_vars_id_seq OWNER TO freeswitch;
+
+--
+-- Name: directory_global_vars_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE directory_global_vars_id_seq OWNED BY directory_global_vars.id;
+
+
+--
+-- Name: directory_group_user_map; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE directory_group_user_map (
+ map_id integer NOT NULL,
+ group_id integer NOT NULL,
+ user_id integer NOT NULL
+);
+
+
+ALTER TABLE public.directory_group_user_map OWNER TO freeswitch;
+
+--
+-- Name: directory_group_user_map_map_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE directory_group_user_map_map_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.directory_group_user_map_map_id_seq OWNER TO freeswitch;
+
+--
+-- Name: directory_group_user_map_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE directory_group_user_map_map_id_seq OWNED BY directory_group_user_map.map_id;
+
+
+--
+-- Name: directory_groups; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE directory_groups (
+ group_id integer NOT NULL,
+ group_name character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.directory_groups OWNER TO freeswitch;
+
+--
+-- Name: directory_groups_group_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE directory_groups_group_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.directory_groups_group_id_seq OWNER TO freeswitch;
+
+--
+-- Name: directory_groups_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE directory_groups_group_id_seq OWNED BY directory_groups.group_id;
+
+
+--
+-- Name: directory_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE directory_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.directory_id_seq OWNER TO freeswitch;
+
+--
+-- Name: directory_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE directory_id_seq OWNED BY directory.id;
+
+
+--
+-- Name: directory_params; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE directory_params (
+ id integer NOT NULL,
+ directory_id integer NOT NULL,
+ param_name character varying(256) NOT NULL,
+ param_value character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.directory_params OWNER TO freeswitch;
+
+--
+-- Name: directory_params_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE directory_params_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.directory_params_id_seq OWNER TO freeswitch;
+
+--
+-- Name: directory_params_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE directory_params_id_seq OWNED BY directory_params.id;
+
+
+--
+-- Name: directory_vars; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE directory_vars (
+ id integer NOT NULL,
+ directory_id integer NOT NULL,
+ var_name character varying(256) NOT NULL,
+ var_value character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.directory_vars OWNER TO freeswitch;
+
+--
+-- Name: directory_vars_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE directory_vars_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.directory_vars_id_seq OWNER TO freeswitch;
+
+--
+-- Name: directory_vars_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE directory_vars_id_seq OWNED BY directory_vars.id;
+
+
+--
+-- Name: easyroute_conf; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE easyroute_conf (
+ id integer NOT NULL,
+ param_name character varying(256) NOT NULL,
+ param_value character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.easyroute_conf OWNER TO freeswitch;
+
+--
+-- Name: easyroute_conf_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE easyroute_conf_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.easyroute_conf_id_seq OWNER TO freeswitch;
+
+--
+-- Name: easyroute_conf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE easyroute_conf_id_seq OWNED BY easyroute_conf.id;
+
+
+--
+-- Name: easyroute_data; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE easyroute_data (
+ id integer NOT NULL,
+ gateway character varying(128) NOT NULL,
+ "group" character varying(128) NOT NULL,
+ call_limit character varying(16) NOT NULL,
+ tech_prefix character varying(128) NOT NULL,
+ acctcode character varying(128) NOT NULL,
+ destination_number character varying(128) NOT NULL
+);
+
+
+ALTER TABLE public.easyroute_data OWNER TO freeswitch;
+
+--
+-- Name: easyroute_data_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE easyroute_data_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.easyroute_data_id_seq OWNER TO freeswitch;
+
+--
+-- Name: easyroute_data_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE easyroute_data_id_seq OWNED BY easyroute_data.id;
+
+
+--
+-- Name: iax_conf; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE iax_conf (
+ id integer NOT NULL,
+ profile_name character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.iax_conf OWNER TO freeswitch;
+
+--
+-- Name: iax_conf_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE iax_conf_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.iax_conf_id_seq OWNER TO freeswitch;
+
+--
+-- Name: iax_conf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE iax_conf_id_seq OWNED BY iax_conf.id;
+
+
+--
+-- Name: iax_settings; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE iax_settings (
+ id integer NOT NULL,
+ iax_id integer NOT NULL,
+ param_name character varying(256) NOT NULL,
+ param_value character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.iax_settings OWNER TO freeswitch;
+
+--
+-- Name: iax_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE iax_settings_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.iax_settings_id_seq OWNER TO freeswitch;
+
+--
+-- Name: iax_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE iax_settings_id_seq OWNED BY iax_settings.id;
+
+
+--
+-- Name: ivr_conf; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE ivr_conf (
+ id integer NOT NULL,
+ name character varying(64) NOT NULL,
+ greet_long character varying(256) NOT NULL,
+ greet_short character varying(256) NOT NULL,
+ invalid_sound character varying(256) NOT NULL,
+ exit_sound character varying(256) NOT NULL,
+ max_failures integer NOT NULL,
+ timeout integer NOT NULL,
+ tts_engine character varying(64) NOT NULL,
+ tts_voice character varying(64) NOT NULL
+);
+
+
+ALTER TABLE public.ivr_conf OWNER TO freeswitch;
+
+--
+-- Name: ivr_conf_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE ivr_conf_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.ivr_conf_id_seq OWNER TO freeswitch;
+
+--
+-- Name: ivr_conf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE ivr_conf_id_seq OWNED BY ivr_conf.id;
+
+
+--
+-- Name: ivr_entries; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE ivr_entries (
+ id integer NOT NULL,
+ ivr_id integer NOT NULL,
+ action character varying(64) NOT NULL,
+ digits character varying(64) NOT NULL,
+ params character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.ivr_entries OWNER TO freeswitch;
+
+--
+-- Name: ivr_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE ivr_entries_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.ivr_entries_id_seq OWNER TO freeswitch;
+
+--
+-- Name: ivr_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE ivr_entries_id_seq OWNED BY ivr_entries.id;
+
+
+--
+-- Name: lcr; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE lcr (
+ id integer NOT NULL,
+ digits numeric(20,0),
+ rate numeric(11,5) NOT NULL,
+ intrastate_rate numeric(11,5) NOT NULL,
+ intralata_rate numeric(11,5) NOT NULL,
+ carrier_id integer NOT NULL,
+ lead_strip integer DEFAULT 0 NOT NULL,
+ trail_strip integer DEFAULT 0 NOT NULL,
+ prefix character varying(16) DEFAULT ''::character varying NOT NULL,
+ suffix character varying(16) DEFAULT ''::character varying NOT NULL,
+ lcr_profile integer DEFAULT 0 NOT NULL,
+ date_start timestamp with time zone DEFAULT '1970-01-01 00:00:00-05'::timestamp with time zone NOT NULL,
+ date_end timestamp with time zone DEFAULT '2030-12-31 00:00:00-05'::timestamp with time zone NOT NULL,
+ quality numeric(10,6) DEFAULT 0 NOT NULL,
+ reliability numeric(10,6) DEFAULT 0 NOT NULL,
+ cid character varying(32) DEFAULT ''::character varying NOT NULL,
+ enabled boolean DEFAULT true NOT NULL
+);
+
+
+ALTER TABLE public.lcr OWNER TO freeswitch;
+
+--
+-- Name: lcr_conf; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE lcr_conf (
+ id integer NOT NULL,
+ param_name character varying(256) NOT NULL,
+ param_value character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.lcr_conf OWNER TO freeswitch;
+
+--
+-- Name: lcr_conf_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE lcr_conf_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.lcr_conf_id_seq OWNER TO freeswitch;
+
+--
+-- Name: lcr_conf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE lcr_conf_id_seq OWNED BY lcr_conf.id;
+
+
+--
+-- Name: lcr_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE lcr_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.lcr_id_seq OWNER TO freeswitch;
+
+--
+-- Name: lcr_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE lcr_id_seq OWNED BY lcr.id;
+
+
+--
+-- Name: lcr_profiles; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE lcr_profiles (
+ id integer NOT NULL,
+ profile_name character varying(128) NOT NULL
+);
+
+
+ALTER TABLE public.lcr_profiles OWNER TO freeswitch;
+
+--
+-- Name: lcr_profiles_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE lcr_profiles_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.lcr_profiles_id_seq OWNER TO freeswitch;
+
+--
+-- Name: lcr_profiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE lcr_profiles_id_seq OWNED BY lcr_profiles.id;
+
+
+--
+-- Name: lcr_settings; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE lcr_settings (
+ id integer NOT NULL,
+ lcr_id integer NOT NULL,
+ param_name character varying(256) NOT NULL,
+ param_value character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.lcr_settings OWNER TO freeswitch;
+
+--
+-- Name: lcr_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE lcr_settings_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.lcr_settings_id_seq OWNER TO freeswitch;
+
+--
+-- Name: lcr_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE lcr_settings_id_seq OWNED BY lcr_settings.id;
+
+
+--
+-- Name: limit_conf; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE limit_conf (
+ id integer NOT NULL,
+ name character varying(256) NOT NULL,
+ value character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.limit_conf OWNER TO freeswitch;
+
+--
+-- Name: limit_conf_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE limit_conf_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.limit_conf_id_seq OWNER TO freeswitch;
+
+--
+-- Name: limit_conf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE limit_conf_id_seq OWNED BY limit_conf.id;
+
+
+--
+-- Name: limit_data; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE limit_data (
+ hostname character varying(255) DEFAULT NULL::character varying,
+ realm character varying(255) DEFAULT NULL::character varying,
+ id character varying(255) DEFAULT NULL::character varying,
+ uuid character varying(255) DEFAULT NULL::character varying
+);
+
+
+ALTER TABLE public.limit_data OWNER TO freeswitch;
+
+--
+-- Name: local_stream_conf; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE local_stream_conf (
+ id integer NOT NULL,
+ directory_name character varying(256) NOT NULL,
+ directory_path text NOT NULL,
+ param_name character varying(256) NOT NULL,
+ param_value character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.local_stream_conf OWNER TO freeswitch;
+
+--
+-- Name: local_stream_conf_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE local_stream_conf_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.local_stream_conf_id_seq OWNER TO freeswitch;
+
+--
+-- Name: local_stream_conf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE local_stream_conf_id_seq OWNED BY local_stream_conf.id;
+
+
+--
+-- Name: modless_conf; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE modless_conf (
+ id integer NOT NULL,
+ conf_name character varying(64) NOT NULL
+);
+
+
+ALTER TABLE public.modless_conf OWNER TO freeswitch;
+
+--
+-- Name: modless_conf_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE modless_conf_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.modless_conf_id_seq OWNER TO freeswitch;
+
+--
+-- Name: modless_conf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE modless_conf_id_seq OWNED BY modless_conf.id;
+
+
+--
+-- Name: npa_nxx_company_ocn; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE npa_nxx_company_ocn (
+ npa smallint NOT NULL,
+ nxx smallint NOT NULL,
+ company_type text,
+ ocn text,
+ company_name text,
+ lata integer,
+ ratecenter text,
+ state text
+);
+
+
+ALTER TABLE public.npa_nxx_company_ocn OWNER TO freeswitch;
+
+--
+-- Name: post_load_modules_conf; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE post_load_modules_conf (
+ id integer NOT NULL,
+ module_name character varying(64) NOT NULL,
+ load_module boolean DEFAULT true NOT NULL,
+ priority integer DEFAULT 1000 NOT NULL
+);
+
+
+ALTER TABLE public.post_load_modules_conf OWNER TO freeswitch;
+
+--
+-- Name: post_load_modules_conf_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE post_load_modules_conf_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.post_load_modules_conf_id_seq OWNER TO freeswitch;
+
+--
+-- Name: post_load_modules_conf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE post_load_modules_conf_id_seq OWNED BY post_load_modules_conf.id;
+
+
+--
+-- Name: rss_conf; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE rss_conf (
+ id integer NOT NULL,
+ directory_id integer NOT NULL,
+ feed text NOT NULL,
+ local_file text NOT NULL,
+ description text NOT NULL,
+ priority integer DEFAULT 1000 NOT NULL
+);
+
+
+ALTER TABLE public.rss_conf OWNER TO freeswitch;
+
+--
+-- Name: rss_conf_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE rss_conf_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.rss_conf_id_seq OWNER TO freeswitch;
+
+--
+-- Name: rss_conf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE rss_conf_id_seq OWNED BY rss_conf.id;
+
+
+--
+-- Name: sip_authentication; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE sip_authentication (
+ nonce character varying(255),
+ expires integer,
+ profile_name character varying(255),
+ hostname character varying(255)
+);
+
+
+ALTER TABLE public.sip_authentication OWNER TO freeswitch;
+
+--
+-- Name: sip_dialogs; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE sip_dialogs (
+ call_id character varying(255),
+ uuid character varying(255),
+ sip_to_user character varying(255),
+ sip_to_host character varying(255),
+ sip_from_user character varying(255),
+ sip_from_host character varying(255),
+ contact_user character varying(255),
+ contact_host character varying(255),
+ state character varying(255),
+ direction character varying(255),
+ user_agent character varying(255),
+ profile_name character varying(255),
+ hostname character varying(255)
+);
+
+
+ALTER TABLE public.sip_dialogs OWNER TO freeswitch;
+
+--
+-- Name: sip_presence; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE sip_presence (
+ sip_user character varying(255),
+ sip_host character varying(255),
+ status character varying(255),
+ rpid character varying(255),
+ expires integer,
+ user_agent character varying(255),
+ profile_name character varying(255),
+ hostname character varying(255),
+ network_ip character varying(255),
+ network_port character varying(6)
+);
+
+
+ALTER TABLE public.sip_presence OWNER TO freeswitch;
+
+--
+-- Name: sip_registrations; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE sip_registrations (
+ call_id character varying(255),
+ sip_user character varying(255),
+ sip_host character varying(255),
+ presence_hosts character varying(255),
+ contact character varying(1024),
+ status character varying(255),
+ rpid character varying(255),
+ expires integer,
+ user_agent character varying(255),
+ server_user character varying(255),
+ server_host character varying(255),
+ profile_name character varying(255),
+ hostname character varying(255),
+ network_ip character varying(255),
+ network_port character varying(6),
+ sip_username character varying(255),
+ sip_realm character varying(255),
+ mwi_user character varying(255),
+ mwi_host character varying(255)
+);
+
+
+ALTER TABLE public.sip_registrations OWNER TO freeswitch;
+
+--
+-- Name: sip_shared_appearance_dialogs; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE sip_shared_appearance_dialogs (
+ profile_name character varying(255),
+ hostname character varying(255),
+ contact_str character varying(255),
+ call_id character varying(255),
+ network_ip character varying(255),
+ expires integer
+);
+
+
+ALTER TABLE public.sip_shared_appearance_dialogs OWNER TO freeswitch;
+
+--
+-- Name: sip_shared_appearance_subscriptions; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE sip_shared_appearance_subscriptions (
+ subscriber character varying(255),
+ call_id character varying(255),
+ aor character varying(255),
+ profile_name character varying(255),
+ hostname character varying(255),
+ contact_str character varying(255),
+ network_ip character varying(255)
+);
+
+
+ALTER TABLE public.sip_shared_appearance_subscriptions OWNER TO freeswitch;
+
+--
+-- Name: sip_subscriptions; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE sip_subscriptions (
+ proto character varying(255),
+ sip_user character varying(255),
+ sip_host character varying(255),
+ sub_to_user character varying(255),
+ sub_to_host character varying(255),
+ presence_hosts character varying(255),
+ event character varying(255),
+ contact character varying(1024),
+ call_id character varying(255),
+ full_from character varying(255),
+ full_via character varying(255),
+ expires integer,
+ user_agent character varying(255),
+ accept character varying(255),
+ profile_name character varying(255),
+ hostname character varying(255),
+ network_port character varying(6),
+ network_ip character varying(255)
+);
+
+
+ALTER TABLE public.sip_subscriptions OWNER TO freeswitch;
+
+--
+-- Name: sofia_aliases; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE sofia_aliases (
+ id integer NOT NULL,
+ sofia_id integer NOT NULL,
+ alias_name character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.sofia_aliases OWNER TO freeswitch;
+
+--
+-- Name: sofia_aliases_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE sofia_aliases_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.sofia_aliases_id_seq OWNER TO freeswitch;
+
+--
+-- Name: sofia_aliases_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE sofia_aliases_id_seq OWNED BY sofia_aliases.id;
+
+
+--
+-- Name: sofia_conf; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE sofia_conf (
+ id integer NOT NULL,
+ profile_name character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.sofia_conf OWNER TO freeswitch;
+
+--
+-- Name: sofia_conf_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE sofia_conf_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.sofia_conf_id_seq OWNER TO freeswitch;
+
+--
+-- Name: sofia_conf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE sofia_conf_id_seq OWNED BY sofia_conf.id;
+
+
+--
+-- Name: sofia_domains; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE sofia_domains (
+ id integer NOT NULL,
+ sofia_id integer NOT NULL,
+ domain_name character varying(256) NOT NULL,
+ parse boolean DEFAULT false NOT NULL
+);
+
+
+ALTER TABLE public.sofia_domains OWNER TO freeswitch;
+
+--
+-- Name: sofia_domains_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE sofia_domains_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.sofia_domains_id_seq OWNER TO freeswitch;
+
+--
+-- Name: sofia_domains_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE sofia_domains_id_seq OWNED BY sofia_domains.id;
+
+
+--
+-- Name: sofia_gateways; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE sofia_gateways (
+ id integer NOT NULL,
+ sofia_id integer NOT NULL,
+ gateway_name character varying(256) NOT NULL,
+ gateway_param character varying(256) NOT NULL,
+ gateway_value character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.sofia_gateways OWNER TO freeswitch;
+
+--
+-- Name: sofia_gateways_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE sofia_gateways_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.sofia_gateways_id_seq OWNER TO freeswitch;
+
+--
+-- Name: sofia_gateways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE sofia_gateways_id_seq OWNED BY sofia_gateways.id;
+
+
+--
+-- Name: sofia_settings; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE sofia_settings (
+ id integer NOT NULL,
+ sofia_id integer NOT NULL,
+ param_name character varying(256) NOT NULL,
+ param_value character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.sofia_settings OWNER TO freeswitch;
+
+--
+-- Name: sofia_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE sofia_settings_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.sofia_settings_id_seq OWNER TO freeswitch;
+
+--
+-- Name: sofia_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE sofia_settings_id_seq OWNED BY sofia_settings.id;
+
+
+--
+-- Name: voicemail_conf; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE voicemail_conf (
+ id integer NOT NULL,
+ vm_profile character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.voicemail_conf OWNER TO freeswitch;
+
+--
+-- Name: voicemail_conf_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE voicemail_conf_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.voicemail_conf_id_seq OWNER TO freeswitch;
+
+--
+-- Name: voicemail_conf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE voicemail_conf_id_seq OWNED BY voicemail_conf.id;
+
+
+--
+-- Name: voicemail_email; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE voicemail_email (
+ id integer NOT NULL,
+ voicemail_id integer NOT NULL,
+ param_name character varying(256) NOT NULL,
+ param_value character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.voicemail_email OWNER TO freeswitch;
+
+--
+-- Name: voicemail_email_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE voicemail_email_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.voicemail_email_id_seq OWNER TO freeswitch;
+
+--
+-- Name: voicemail_email_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE voicemail_email_id_seq OWNED BY voicemail_email.id;
+
+
+--
+-- Name: voicemail_msgs; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE voicemail_msgs (
+ created_epoch integer,
+ read_epoch integer,
+ username character varying(255),
+ domain character varying(255),
+ uuid character varying(255),
+ cid_name character varying(255),
+ cid_number character varying(255),
+ in_folder character varying(255),
+ file_path character varying(255),
+ message_len integer,
+ flags character varying(255),
+ read_flags character varying(255)
+);
+
+
+ALTER TABLE public.voicemail_msgs OWNER TO freeswitch;
+
+--
+-- Name: voicemail_prefs; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE voicemail_prefs (
+ username character varying(255),
+ domain character varying(255),
+ name_path character varying(255),
+ greeting_path character varying(255),
+ password character varying(255)
+);
+
+
+ALTER TABLE public.voicemail_prefs OWNER TO freeswitch;
+
+--
+-- Name: voicemail_settings; Type: TABLE; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE TABLE voicemail_settings (
+ id integer NOT NULL,
+ voicemail_id integer NOT NULL,
+ param_name character varying(256) NOT NULL,
+ param_value character varying(256) NOT NULL
+);
+
+
+ALTER TABLE public.voicemail_settings OWNER TO freeswitch;
+
+--
+-- Name: voicemail_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: freeswitch
+--
+
+CREATE SEQUENCE voicemail_settings_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.voicemail_settings_id_seq OWNER TO freeswitch;
+
+--
+-- Name: voicemail_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freeswitch
+--
+
+ALTER SEQUENCE voicemail_settings_id_seq OWNED BY voicemail_settings.id;
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE accounts ALTER COLUMN id SET DEFAULT nextval('accounts_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE acl_lists ALTER COLUMN id SET DEFAULT nextval('acl_lists_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE acl_nodes ALTER COLUMN id SET DEFAULT nextval('acl_nodes_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE carrier_gateway ALTER COLUMN id SET DEFAULT nextval('carrier_gateway_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE carriers ALTER COLUMN id SET DEFAULT nextval('carriers_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE conference_advertise ALTER COLUMN id SET DEFAULT nextval('conference_advertise_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE conference_controls ALTER COLUMN id SET DEFAULT nextval('conference_controls_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE conference_profiles ALTER COLUMN id SET DEFAULT nextval('conference_profiles_id_seq'::regclass);
+
+
+--
+-- Name: dialplan_id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE dialplan ALTER COLUMN dialplan_id SET DEFAULT nextval('dialplan_dialplan_id_seq'::regclass);
+
+
+--
+-- Name: action_id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE dialplan_actions ALTER COLUMN action_id SET DEFAULT nextval('dialplan_actions_action_id_seq'::regclass);
+
+
+--
+-- Name: condition_id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE dialplan_condition ALTER COLUMN condition_id SET DEFAULT nextval('dialplan_condition_condition_id_seq'::regclass);
+
+
+--
+-- Name: context_id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE dialplan_context ALTER COLUMN context_id SET DEFAULT nextval('dialplan_context_context_id_seq'::regclass);
+
+
+--
+-- Name: extension_id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE dialplan_extension ALTER COLUMN extension_id SET DEFAULT nextval('dialplan_extension_extension_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE dialplan_special ALTER COLUMN id SET DEFAULT nextval('dialplan_special_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE dingaling_profile_params ALTER COLUMN id SET DEFAULT nextval('dingaling_profile_params_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE dingaling_profiles ALTER COLUMN id SET DEFAULT nextval('dingaling_profiles_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE dingaling_settings ALTER COLUMN id SET DEFAULT nextval('dingaling_settings_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE directory ALTER COLUMN id SET DEFAULT nextval('directory_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE directory_domains ALTER COLUMN id SET DEFAULT nextval('directory_domains_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE directory_gateway_params ALTER COLUMN id SET DEFAULT nextval('directory_gateway_params_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE directory_gateways ALTER COLUMN id SET DEFAULT nextval('directory_gateways_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE directory_global_params ALTER COLUMN id SET DEFAULT nextval('directory_global_params_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE directory_global_vars ALTER COLUMN id SET DEFAULT nextval('directory_global_vars_id_seq'::regclass);
+
+
+--
+-- Name: map_id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE directory_group_user_map ALTER COLUMN map_id SET DEFAULT nextval('directory_group_user_map_map_id_seq'::regclass);
+
+
+--
+-- Name: group_id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE directory_groups ALTER COLUMN group_id SET DEFAULT nextval('directory_groups_group_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE directory_params ALTER COLUMN id SET DEFAULT nextval('directory_params_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE directory_vars ALTER COLUMN id SET DEFAULT nextval('directory_vars_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE easyroute_conf ALTER COLUMN id SET DEFAULT nextval('easyroute_conf_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE easyroute_data ALTER COLUMN id SET DEFAULT nextval('easyroute_data_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE iax_conf ALTER COLUMN id SET DEFAULT nextval('iax_conf_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE iax_settings ALTER COLUMN id SET DEFAULT nextval('iax_settings_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ivr_conf ALTER COLUMN id SET DEFAULT nextval('ivr_conf_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ivr_entries ALTER COLUMN id SET DEFAULT nextval('ivr_entries_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE lcr ALTER COLUMN id SET DEFAULT nextval('lcr_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE lcr_conf ALTER COLUMN id SET DEFAULT nextval('lcr_conf_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE lcr_profiles ALTER COLUMN id SET DEFAULT nextval('lcr_profiles_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE lcr_settings ALTER COLUMN id SET DEFAULT nextval('lcr_settings_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE limit_conf ALTER COLUMN id SET DEFAULT nextval('limit_conf_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE local_stream_conf ALTER COLUMN id SET DEFAULT nextval('local_stream_conf_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE modless_conf ALTER COLUMN id SET DEFAULT nextval('modless_conf_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE post_load_modules_conf ALTER COLUMN id SET DEFAULT nextval('post_load_modules_conf_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE rss_conf ALTER COLUMN id SET DEFAULT nextval('rss_conf_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE sofia_aliases ALTER COLUMN id SET DEFAULT nextval('sofia_aliases_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE sofia_conf ALTER COLUMN id SET DEFAULT nextval('sofia_conf_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE sofia_domains ALTER COLUMN id SET DEFAULT nextval('sofia_domains_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE sofia_gateways ALTER COLUMN id SET DEFAULT nextval('sofia_gateways_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE sofia_settings ALTER COLUMN id SET DEFAULT nextval('sofia_settings_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE voicemail_conf ALTER COLUMN id SET DEFAULT nextval('voicemail_conf_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE voicemail_email ALTER COLUMN id SET DEFAULT nextval('voicemail_email_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE voicemail_settings ALTER COLUMN id SET DEFAULT nextval('voicemail_settings_id_seq'::regclass);
+
+
+--
+-- Name: acl_lists_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY acl_lists
+ ADD CONSTRAINT acl_lists_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: acl_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY acl_nodes
+ ADD CONSTRAINT acl_nodes_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: carrier_gateway_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY carrier_gateway
+ ADD CONSTRAINT carrier_gateway_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: carriers_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY carriers
+ ADD CONSTRAINT carriers_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: conference_advertise_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY conference_advertise
+ ADD CONSTRAINT conference_advertise_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: conference_controls_conf_group_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY conference_controls
+ ADD CONSTRAINT conference_controls_conf_group_key UNIQUE (conf_group, action);
+
+
+--
+-- Name: conference_controls_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY conference_controls
+ ADD CONSTRAINT conference_controls_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: conference_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY conference_profiles
+ ADD CONSTRAINT conference_profiles_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: conference_profiles_profile_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY conference_profiles
+ ADD CONSTRAINT conference_profiles_profile_name_key UNIQUE (profile_name, param_name);
+
+
+--
+-- Name: dialplan_actions_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dialplan_actions
+ ADD CONSTRAINT dialplan_actions_pkey PRIMARY KEY (action_id);
+
+
+--
+-- Name: dialplan_condition_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dialplan_condition
+ ADD CONSTRAINT dialplan_condition_pkey PRIMARY KEY (condition_id);
+
+
+--
+-- Name: dialplan_context_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dialplan_context
+ ADD CONSTRAINT dialplan_context_pkey PRIMARY KEY (context_id);
+
+
+--
+-- Name: dialplan_extension_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dialplan_extension
+ ADD CONSTRAINT dialplan_extension_pkey PRIMARY KEY (extension_id);
+
+
+--
+-- Name: dialplan_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dialplan
+ ADD CONSTRAINT dialplan_pkey PRIMARY KEY (dialplan_id);
+
+
+--
+-- Name: dialplan_special_context_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dialplan_special
+ ADD CONSTRAINT dialplan_special_context_key UNIQUE (context);
+
+
+--
+-- Name: dialplan_special_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dialplan_special
+ ADD CONSTRAINT dialplan_special_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: dingaling_profile_params_dingaling_id_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dingaling_profile_params
+ ADD CONSTRAINT dingaling_profile_params_dingaling_id_key UNIQUE (dingaling_id, param_name);
+
+
+--
+-- Name: dingaling_profile_params_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dingaling_profile_params
+ ADD CONSTRAINT dingaling_profile_params_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: dingaling_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dingaling_profiles
+ ADD CONSTRAINT dingaling_profiles_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: dingaling_profiles_profile_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dingaling_profiles
+ ADD CONSTRAINT dingaling_profiles_profile_name_key UNIQUE (profile_name);
+
+
+--
+-- Name: dingaling_settings_param_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dingaling_settings
+ ADD CONSTRAINT dingaling_settings_param_name_key UNIQUE (param_name);
+
+
+--
+-- Name: dingaling_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY dingaling_settings
+ ADD CONSTRAINT dingaling_settings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: directory_domains_domain_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_domains
+ ADD CONSTRAINT directory_domains_domain_name_key UNIQUE (domain_name);
+
+
+--
+-- Name: directory_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_domains
+ ADD CONSTRAINT directory_domains_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: directory_gateway_params_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_gateway_params
+ ADD CONSTRAINT directory_gateway_params_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: directory_gateways_gateway_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_gateways
+ ADD CONSTRAINT directory_gateways_gateway_name_key UNIQUE (gateway_name);
+
+
+--
+-- Name: directory_gateways_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_gateways
+ ADD CONSTRAINT directory_gateways_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: directory_global_params_directory_id_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_global_params
+ ADD CONSTRAINT directory_global_params_directory_id_key UNIQUE (domain_id, param_name);
+
+
+--
+-- Name: directory_global_params_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_global_params
+ ADD CONSTRAINT directory_global_params_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: directory_global_vars_directory_id_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_global_vars
+ ADD CONSTRAINT directory_global_vars_directory_id_key UNIQUE (domain_id, var_name);
+
+
+--
+-- Name: directory_global_vars_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_global_vars
+ ADD CONSTRAINT directory_global_vars_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: directory_group_user_map_group_id_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_group_user_map
+ ADD CONSTRAINT directory_group_user_map_group_id_key UNIQUE (group_id, user_id);
+
+
+--
+-- Name: directory_group_user_map_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_group_user_map
+ ADD CONSTRAINT directory_group_user_map_pkey PRIMARY KEY (map_id);
+
+
+--
+-- Name: directory_groups_group_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_groups
+ ADD CONSTRAINT directory_groups_group_name_key UNIQUE (group_name);
+
+
+--
+-- Name: directory_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_groups
+ ADD CONSTRAINT directory_groups_pkey PRIMARY KEY (group_id);
+
+
+--
+-- Name: directory_params_directory_id_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_params
+ ADD CONSTRAINT directory_params_directory_id_key UNIQUE (directory_id, param_name);
+
+
+--
+-- Name: directory_params_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_params
+ ADD CONSTRAINT directory_params_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: directory_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory
+ ADD CONSTRAINT directory_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: directory_username_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory
+ ADD CONSTRAINT directory_username_key UNIQUE (username, domain);
+
+
+--
+-- Name: directory_vars_directory_id_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_vars
+ ADD CONSTRAINT directory_vars_directory_id_key UNIQUE (directory_id, var_name);
+
+
+--
+-- Name: directory_vars_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY directory_vars
+ ADD CONSTRAINT directory_vars_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: easyroute_conf_param_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY easyroute_conf
+ ADD CONSTRAINT easyroute_conf_param_name_key UNIQUE (param_name);
+
+
+--
+-- Name: easyroute_conf_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY easyroute_conf
+ ADD CONSTRAINT easyroute_conf_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: easyroute_data_destination_number_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY easyroute_data
+ ADD CONSTRAINT easyroute_data_destination_number_key UNIQUE (destination_number);
+
+
+--
+-- Name: easyroute_data_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY easyroute_data
+ ADD CONSTRAINT easyroute_data_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: iax_conf_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY iax_conf
+ ADD CONSTRAINT iax_conf_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: iax_conf_profile_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY iax_conf
+ ADD CONSTRAINT iax_conf_profile_name_key UNIQUE (profile_name);
+
+
+--
+-- Name: iax_settings_iax_id_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY iax_settings
+ ADD CONSTRAINT iax_settings_iax_id_key UNIQUE (iax_id, param_name);
+
+
+--
+-- Name: iax_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY iax_settings
+ ADD CONSTRAINT iax_settings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: ivr_conf_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY ivr_conf
+ ADD CONSTRAINT ivr_conf_name_key UNIQUE (name);
+
+
+--
+-- Name: ivr_conf_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY ivr_conf
+ ADD CONSTRAINT ivr_conf_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: ivr_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY ivr_entries
+ ADD CONSTRAINT ivr_entries_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: lcr_conf_param_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY lcr_conf
+ ADD CONSTRAINT lcr_conf_param_name_key UNIQUE (param_name);
+
+
+--
+-- Name: lcr_conf_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY lcr_conf
+ ADD CONSTRAINT lcr_conf_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: lcr_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY lcr
+ ADD CONSTRAINT lcr_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: lcr_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY lcr_profiles
+ ADD CONSTRAINT lcr_profiles_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: lcr_profiles_profile_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY lcr_profiles
+ ADD CONSTRAINT lcr_profiles_profile_name_key UNIQUE (profile_name);
+
+
+--
+-- Name: lcr_settings_lcr_id_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY lcr_settings
+ ADD CONSTRAINT lcr_settings_lcr_id_key UNIQUE (lcr_id, param_name);
+
+
+--
+-- Name: lcr_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY lcr_settings
+ ADD CONSTRAINT lcr_settings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: limit_conf_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY limit_conf
+ ADD CONSTRAINT limit_conf_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: local_stream_conf_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY local_stream_conf
+ ADD CONSTRAINT local_stream_conf_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: modless_conf_conf_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY modless_conf
+ ADD CONSTRAINT modless_conf_conf_name_key UNIQUE (conf_name);
+
+
+--
+-- Name: modless_conf_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY modless_conf
+ ADD CONSTRAINT modless_conf_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: npa_nxx_company_ocn_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY npa_nxx_company_ocn
+ ADD CONSTRAINT npa_nxx_company_ocn_pkey PRIMARY KEY (npa, nxx);
+
+
+--
+-- Name: post_load_modules_conf_module_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY post_load_modules_conf
+ ADD CONSTRAINT post_load_modules_conf_module_name_key UNIQUE (module_name);
+
+
+--
+-- Name: post_load_modules_conf_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY post_load_modules_conf
+ ADD CONSTRAINT post_load_modules_conf_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: rss_conf_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY rss_conf
+ ADD CONSTRAINT rss_conf_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: sofia_aliases_alias_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY sofia_aliases
+ ADD CONSTRAINT sofia_aliases_alias_name_key UNIQUE (alias_name);
+
+
+--
+-- Name: sofia_aliases_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY sofia_aliases
+ ADD CONSTRAINT sofia_aliases_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: sofia_conf_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY sofia_conf
+ ADD CONSTRAINT sofia_conf_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: sofia_conf_profile_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY sofia_conf
+ ADD CONSTRAINT sofia_conf_profile_name_key UNIQUE (profile_name);
+
+
+--
+-- Name: sofia_domains_domain_name_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY sofia_domains
+ ADD CONSTRAINT sofia_domains_domain_name_key UNIQUE (domain_name);
+
+
+--
+-- Name: sofia_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY sofia_domains
+ ADD CONSTRAINT sofia_domains_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: sofia_gateways_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY sofia_gateways
+ ADD CONSTRAINT sofia_gateways_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: sofia_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY sofia_settings
+ ADD CONSTRAINT sofia_settings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: sofia_settings_sofia_id_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY sofia_settings
+ ADD CONSTRAINT sofia_settings_sofia_id_key UNIQUE (sofia_id, param_name);
+
+
+--
+-- Name: voicemail_conf_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY voicemail_conf
+ ADD CONSTRAINT voicemail_conf_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: voicemail_conf_vm_profile_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY voicemail_conf
+ ADD CONSTRAINT voicemail_conf_vm_profile_key UNIQUE (vm_profile);
+
+
+--
+-- Name: voicemail_email_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY voicemail_email
+ ADD CONSTRAINT voicemail_email_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: voicemail_email_voicemail_id_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY voicemail_email
+ ADD CONSTRAINT voicemail_email_voicemail_id_key UNIQUE (voicemail_id, param_name);
+
+
+--
+-- Name: voicemail_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY voicemail_settings
+ ADD CONSTRAINT voicemail_settings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: voicemail_settings_voicemail_id_key; Type: CONSTRAINT; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+ALTER TABLE ONLY voicemail_settings
+ ADD CONSTRAINT voicemail_settings_voicemail_id_key UNIQUE (voicemail_id, param_name);
+
+
+--
+-- Name: digits_rate; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX digits_rate ON lcr USING btree (digits, rate);
+
+
+--
+-- Name: fki_; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX fki_ ON acl_nodes USING btree (list_id);
+
+
+--
+-- Name: fki_lcr_profile; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX fki_lcr_profile ON lcr USING btree (lcr_profile);
+
+
+--
+-- Name: gateway; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE UNIQUE INDEX gateway ON carrier_gateway USING btree (prefix, suffix);
+
+
+--
+-- Name: profile_digits_15; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX profile_digits_15 ON lcr USING btree (digits, lcr_profile);
+
+
+--
+-- Name: sa_hostname; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sa_hostname ON sip_authentication USING btree (hostname);
+
+
+--
+-- Name: sa_nonce; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sa_nonce ON sip_authentication USING btree (nonce);
+
+
+--
+-- Name: sd_hostname; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sd_hostname ON sip_dialogs USING btree (hostname);
+
+
+--
+-- Name: sd_uuid; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sd_uuid ON sip_dialogs USING btree (uuid);
+
+
+--
+-- Name: sp_hostname; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sp_hostname ON sip_presence USING btree (hostname);
+
+
+--
+-- Name: sr_call_id; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_call_id ON sip_registrations USING btree (call_id);
+
+
+--
+-- Name: sr_contact; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_contact ON sip_registrations USING btree (contact);
+
+
+--
+-- Name: sr_expires; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_expires ON sip_registrations USING btree (expires);
+
+
+--
+-- Name: sr_hostname; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_hostname ON sip_registrations USING btree (hostname);
+
+
+--
+-- Name: sr_network_ip; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_network_ip ON sip_registrations USING btree (network_ip);
+
+
+--
+-- Name: sr_network_port; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_network_port ON sip_registrations USING btree (network_port);
+
+
+--
+-- Name: sr_presence_hosts; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_presence_hosts ON sip_registrations USING btree (presence_hosts);
+
+
+--
+-- Name: sr_profile_name; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_profile_name ON sip_registrations USING btree (profile_name);
+
+
+--
+-- Name: sr_sip_host; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_sip_host ON sip_registrations USING btree (sip_host);
+
+
+--
+-- Name: sr_sip_realm; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_sip_realm ON sip_registrations USING btree (sip_realm);
+
+
+--
+-- Name: sr_sip_user; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_sip_user ON sip_registrations USING btree (sip_user);
+
+
+--
+-- Name: sr_sip_username; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_sip_username ON sip_registrations USING btree (sip_username);
+
+
+--
+-- Name: sr_status; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX sr_status ON sip_registrations USING btree (status);
+
+
+--
+-- Name: ss_call_id; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ss_call_id ON sip_subscriptions USING btree (call_id);
+
+
+--
+-- Name: ss_event; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ss_event ON sip_subscriptions USING btree (event);
+
+
+--
+-- Name: ss_hostname; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ss_hostname ON sip_subscriptions USING btree (hostname);
+
+
+--
+-- Name: ss_presence_hosts; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ss_presence_hosts ON sip_subscriptions USING btree (presence_hosts);
+
+
+--
+-- Name: ss_proto; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ss_proto ON sip_subscriptions USING btree (proto);
+
+
+--
+-- Name: ss_sip_host; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ss_sip_host ON sip_subscriptions USING btree (sip_host);
+
+
+--
+-- Name: ss_sip_user; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ss_sip_user ON sip_subscriptions USING btree (sip_user);
+
+
+--
+-- Name: ss_sub_to_host; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ss_sub_to_host ON sip_subscriptions USING btree (sub_to_host);
+
+
+--
+-- Name: ss_sub_to_user; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ss_sub_to_user ON sip_subscriptions USING btree (sub_to_user);
+
+
+--
+-- Name: ssa_aor; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ssa_aor ON sip_shared_appearance_subscriptions USING btree (aor);
+
+
+--
+-- Name: ssa_hostname; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ssa_hostname ON sip_shared_appearance_subscriptions USING btree (hostname);
+
+
+--
+-- Name: ssa_profile_name; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ssa_profile_name ON sip_shared_appearance_subscriptions USING btree (profile_name);
+
+
+--
+-- Name: ssa_subscriber; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ssa_subscriber ON sip_shared_appearance_subscriptions USING btree (subscriber);
+
+
+--
+-- Name: ssd_call_id; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ssd_call_id ON sip_shared_appearance_dialogs USING btree (call_id);
+
+
+--
+-- Name: ssd_contact_str; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ssd_contact_str ON sip_shared_appearance_dialogs USING btree (contact_str);
+
+
+--
+-- Name: ssd_expires; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ssd_expires ON sip_shared_appearance_dialogs USING btree (expires);
+
+
+--
+-- Name: ssd_hostname; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ssd_hostname ON sip_shared_appearance_dialogs USING btree (hostname);
+
+
+--
+-- Name: ssd_profile_name; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX ssd_profile_name ON sip_shared_appearance_dialogs USING btree (profile_name);
+
+
+--
+-- Name: unique_route; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX unique_route ON lcr USING btree (digits, carrier_id);
+
+
+--
+-- Name: voicemail_msgs_idx1; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX voicemail_msgs_idx1 ON voicemail_msgs USING btree (created_epoch);
+
+
+--
+-- Name: voicemail_msgs_idx2; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX voicemail_msgs_idx2 ON voicemail_msgs USING btree (username);
+
+
+--
+-- Name: voicemail_msgs_idx3; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX voicemail_msgs_idx3 ON voicemail_msgs USING btree (domain);
+
+
+--
+-- Name: voicemail_msgs_idx4; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX voicemail_msgs_idx4 ON voicemail_msgs USING btree (uuid);
+
+
+--
+-- Name: voicemail_msgs_idx5; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX voicemail_msgs_idx5 ON voicemail_msgs USING btree (in_folder);
+
+
+--
+-- Name: voicemail_msgs_idx6; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX voicemail_msgs_idx6 ON voicemail_msgs USING btree (read_flags);
+
+
+--
+-- Name: voicemail_prefs_idx1; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX voicemail_prefs_idx1 ON voicemail_prefs USING btree (username);
+
+
+--
+-- Name: voicemail_prefs_idx2; Type: INDEX; Schema: public; Owner: freeswitch; Tablespace:
+--
+
+CREATE INDEX voicemail_prefs_idx2 ON voicemail_prefs USING btree (domain);
+
+
+--
+-- Name: acl_nodes_list_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY acl_nodes
+ ADD CONSTRAINT acl_nodes_list_id_fkey FOREIGN KEY (list_id) REFERENCES acl_lists(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: carrier_gateway_carrier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY carrier_gateway
+ ADD CONSTRAINT carrier_gateway_carrier_id_fkey FOREIGN KEY (carrier_id) REFERENCES carriers(id);
+
+
+--
+-- Name: dialplan_actions_condition_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY dialplan_actions
+ ADD CONSTRAINT dialplan_actions_condition_id_fkey FOREIGN KEY (condition_id) REFERENCES dialplan_condition(condition_id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: dialplan_condition_extension_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY dialplan_condition
+ ADD CONSTRAINT dialplan_condition_extension_id_fkey FOREIGN KEY (extension_id) REFERENCES dialplan_extension(extension_id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: dialplan_context_dialplan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY dialplan_context
+ ADD CONSTRAINT dialplan_context_dialplan_id_fkey FOREIGN KEY (dialplan_id) REFERENCES dialplan(dialplan_id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: dialplan_extension_context_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY dialplan_extension
+ ADD CONSTRAINT dialplan_extension_context_id_fkey FOREIGN KEY (context_id) REFERENCES dialplan_context(context_id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: dingaling_profile_params_dingaling_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY dingaling_profile_params
+ ADD CONSTRAINT dingaling_profile_params_dingaling_id_fkey FOREIGN KEY (dingaling_id) REFERENCES dingaling_profiles(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: directory_gateway_params_d_gw_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY directory_gateway_params
+ ADD CONSTRAINT directory_gateway_params_d_gw_id_fkey FOREIGN KEY (d_gw_id) REFERENCES directory_gateways(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: directory_gateways_directory_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY directory_gateways
+ ADD CONSTRAINT directory_gateways_directory_id_fkey FOREIGN KEY (directory_id) REFERENCES directory(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: directory_global_params_directory_id_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY directory_global_params
+ ADD CONSTRAINT directory_global_params_directory_id_fkey1 FOREIGN KEY (domain_id) REFERENCES directory_domains(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: directory_global_vars_directory_id_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY directory_global_vars
+ ADD CONSTRAINT directory_global_vars_directory_id_fkey1 FOREIGN KEY (domain_id) REFERENCES directory_domains(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: directory_group_user_map_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY directory_group_user_map
+ ADD CONSTRAINT directory_group_user_map_group_id_fkey FOREIGN KEY (group_id) REFERENCES directory_groups(group_id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: directory_group_user_map_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY directory_group_user_map
+ ADD CONSTRAINT directory_group_user_map_user_id_fkey FOREIGN KEY (user_id) REFERENCES directory(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: directory_params_directory_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY directory_params
+ ADD CONSTRAINT directory_params_directory_id_fkey FOREIGN KEY (directory_id) REFERENCES directory(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: directory_vars_directory_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY directory_vars
+ ADD CONSTRAINT directory_vars_directory_id_fkey FOREIGN KEY (directory_id) REFERENCES directory(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: iax_settings_iax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY iax_settings
+ ADD CONSTRAINT iax_settings_iax_id_fkey FOREIGN KEY (iax_id) REFERENCES iax_conf(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: ivr_entries_ivr_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY ivr_entries
+ ADD CONSTRAINT ivr_entries_ivr_id_fkey FOREIGN KEY (ivr_id) REFERENCES ivr_conf(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: lcr_carrier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY lcr
+ ADD CONSTRAINT lcr_carrier_id_fkey FOREIGN KEY (carrier_id) REFERENCES carriers(id);
+
+
+--
+-- Name: lcr_profile; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY lcr
+ ADD CONSTRAINT lcr_profile FOREIGN KEY (lcr_profile) REFERENCES lcr_profiles(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: lcr_settings_lcr_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY lcr_settings
+ ADD CONSTRAINT lcr_settings_lcr_id_fkey FOREIGN KEY (lcr_id) REFERENCES lcr_profiles(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: sofia_aliases_sofia_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY sofia_aliases
+ ADD CONSTRAINT sofia_aliases_sofia_id_fkey FOREIGN KEY (sofia_id) REFERENCES sofia_conf(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: sofia_domains_sofia_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY sofia_domains
+ ADD CONSTRAINT sofia_domains_sofia_id_fkey FOREIGN KEY (sofia_id) REFERENCES sofia_conf(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: sofia_gateways_sofia_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY sofia_gateways
+ ADD CONSTRAINT sofia_gateways_sofia_id_fkey FOREIGN KEY (sofia_id) REFERENCES sofia_conf(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: sofia_settings_sofia_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY sofia_settings
+ ADD CONSTRAINT sofia_settings_sofia_id_fkey FOREIGN KEY (sofia_id) REFERENCES sofia_conf(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: voicemail_email_voicemail_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY voicemail_email
+ ADD CONSTRAINT voicemail_email_voicemail_id_fkey FOREIGN KEY (voicemail_id) REFERENCES voicemail_conf(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: voicemail_settings_voicemail_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freeswitch
+--
+
+ALTER TABLE ONLY voicemail_settings
+ ADD CONSTRAINT voicemail_settings_voicemail_id_fkey FOREIGN KEY (voicemail_id) REFERENCES voicemail_conf(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: public; Type: ACL; Schema: -; Owner: postgres
+--
+
+REVOKE ALL ON SCHEMA public FROM PUBLIC;
+REVOKE ALL ON SCHEMA public FROM postgres;
+GRANT ALL ON SCHEMA public TO postgres;
+GRANT ALL ON SCHEMA public TO PUBLIC;
+
+
+--
+-- PostgreSQL database dump complete
+--
+
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_sock/fs_sock.php (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_sock/fs_sock.php 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/intralanman/PHP/fs_sock/fs_sock.php 2009-11-02 10:10:22 UTC (rev 15314)
@@ -9,11 +9,11 @@
*
*/
class fs_sock {
- /**
- * file handler for FreeSWITCH socket connection
- *
- * @var file pointer
- */
+/**
+ * file handler for FreeSWITCH socket connection
+ *
+ * @var file pointer
+ */
public $sock;
/**
@@ -43,10 +43,10 @@
*/
function fs_sock($vars=null) {
if (!defined('BUFFER_SIZE')) {
- /**
- * This is the buffer size for fread/fgets operations (default 4096)
- * Define BUFFER_SIZE before instantiation to use a different size
- */
+ /**
+ * This is the buffer size for fread/fgets operations (default 4096)
+ * Define BUFFER_SIZE before instantiation to use a different size
+ */
define('BUFFER_SIZE', 4096);
}
$vars_array = is_array($vars) ? $vars : array();
@@ -77,23 +77,23 @@
*/
function set_initial_vars($var_array) {
$defaults = array(
- 'host' => '127.0.0.1',
- 'port' => '8021',
- 'pass' => 'ClueCon',
- 'timeout' => 30,
- 'stream_timeout' => 5
+ 'host' => '127.0.0.1',
+ 'port' => '8021',
+ 'pass' => 'ClueCon',
+ 'timeout' => 30,
+ 'stream_timeout' => 5
);
if (array_key_exists('host', $var_array)
- && $var_array['host'] == 'localhost') {
- //$this -> debug('Replacing localhost with 127.0.0.1');
+ && $var_array['host'] == 'localhost') {
+ //$this -> debug('Replacing localhost with 127.0.0.1');
$var_array['host'] = '127.0.0.1';
}
foreach ($defaults as $key => $val) {
if (array_key_exists($key, $var_array)) {
- //$this -> debug("$key found in vars");
+ //$this -> debug("$key found in vars");
$connection_settings[$key] = $var_array[$key];
} else {
- //$this -> debug("$key not found in vars");
+ //$this -> debug("$key not found in vars");
$connection_settings[$key] = $val;
}
}
@@ -108,19 +108,19 @@
* @return boolean
*/
function sock_connect($sock_array) {
- //$this -> debug($sock_array);
+ //$this -> debug($sock_array);
$host = $sock_array['host'];
$port = $sock_array['port'];
$timeout = $sock_array['timeout'];
$this -> sock = fsockopen($host, $port, $errno, $errstr, $timeout);
if (!$this -> sock) {
$error = sprintf('Unable to connect to %s:%s Error #%s: %s'
- , $host, $port, $errno, $errstr
+ , $host, $port, $errno, $errstr
);
trigger_error($error, E_USER_ERROR);
return false;
} else {
- //$this -> debug(stream_get_meta_data($this -> sock));
+ //$this -> debug(stream_get_meta_data($this -> sock));
$this -> set_stream_opts($sock_array);
return true;
}
@@ -133,9 +133,9 @@
* @return void
*/
function set_stream_opts($opts) {
- //$this -> debug($opts);
+ //$this -> debug($opts);
if (ereg('^[0-9]*\.[0-9]+$', $opts['stream_timeout'])) {
- //$this -> debug($opts['stream_timeout'] . ' seems to be a float');
+ //$this -> debug($opts['stream_timeout'] . ' seems to be a float');
$time_opts = split('\.', $opts['stream_timeout']);
//$this -> debug($time_opts);
$secs = sprintf('%d', $time_opts[0]);
@@ -146,7 +146,7 @@
}
if (!stream_set_timeout($this -> sock, $secs, $ms)) {
$this -> debug(
- "Failed to set timeout to $secs seconds and $ms microseconds"
+ "Failed to set timeout to $secs seconds and $ms microseconds"
);
}
}
@@ -160,7 +160,7 @@
function sock_auth($pass) {
$reply = $this -> send_command("auth $pass");
if (is_array($reply) && array_key_exists('Reply-Text', $reply)
- && ereg('^\+?OK', $reply['Reply-Text'])) {
+ && ereg('^\+?OK', $reply['Reply-Text'])) {
$this -> debug('Successfully authenticated');
$this -> debug($reply);
$this -> auth = true;
@@ -200,7 +200,7 @@
$event[$header] = $value;
}
} elseif (is_array($event)
- && array_key_exists('Content-Length', $event)) {
+ && array_key_exists('Content-Length', $event)) {
$this -> debug("line is empty: " . (empty($trim_line) ? 'true' : 'false'));
$event['Body'] = $this -> sock_get_length($event['Content-Length']);
break;
@@ -214,7 +214,7 @@
}
/**
- * Read $content_len bytes from the socket
+ * Read $content_len bytes from the socket splitting by :
*
* @param integer $content_len
* @return array
@@ -234,8 +234,8 @@
$value = trim($split[1]);
$content[$attribute] = urldecode($value);
} elseif (empty($trim_line) && is_array($content)
- && array_key_exists('Content-Length', $content)) {
- $content['Body'] = $this -> sock_get_length($content['Content-Length']);
+ && array_key_exists('Content-Length', $content)) {
+ $content['Body'] = $this -> sock_get_body($content['Content-Length']);
$len += $content['Content-Length'];
break;
} elseif (!empty($trim_line)) {
@@ -251,6 +251,32 @@
}
/**
+ * Read $content_len bytes from the socket
+ *
+ * @param integer $content_len
+ * @return array
+ */
+ private function sock_get_body($content_len) {
+ $len = 0;
+ $content = null;
+
+ while ($orig_line = fgets($this -> sock, BUFFER_SIZE)) {
+
+ $len += strlen($orig_line);
+ $trim_line = trim($orig_line);
+
+ $content .= $trim_line;
+
+ if ($len >= $content_len) {
+ break;
+ }
+
+ }
+
+ return $content;
+ }
+
+ /**
* Send a command to the FreeSWITCH event socket
* This method sends a command string to the FreeSWITCH event socket and
* returns true upon success and false upon failure
@@ -271,7 +297,7 @@
$this -> sock_put("$cmd\r\n\r\n", $sock);
if ($this -> command != 'exit') {
$reply = $this -> sock_get($sock);
- //$this -> debug($reply);
+ //$this -> debug($reply);
} else {
unset($this -> command);
return;
@@ -298,8 +324,8 @@
while ($reply['Content-Type'] != 'api/response') {
if (count($reply) > 0) {
$debug_text = sprintf(
- "%s - (%s) != (api/response) adding an event to the output buffer"
- , count($reply), $reply['Content-Type']
+ "%s - (%s) != (api/response) adding an event to the output buffer"
+ , count($reply), $reply['Content-Type']
);
$this -> debug($debug_text);
$this -> output_buffer[] = $reply;
@@ -320,8 +346,8 @@
while ($reply['Content-Type'] != 'command/reply') {
if (count($reply) > 0) {
$debug_text = sprintf(
- "%s - (%s) != (command/reply) adding an event to the output buffer"
- , count($reply), $reply['Content-Type']
+ "%s - (%s) != (command/reply) adding an event to the output buffer"
+ , count($reply), $reply['Content-Type']
);
$this -> debug($debug_text);
$this -> output_buffer[] = $reply;
@@ -410,10 +436,10 @@
$this -> debug(")", $spaces);
} else {
if (is_array($_SERVER)
- && array_key_exists('HTTP_HOST', $_SERVER)) {
+ && array_key_exists('HTTP_HOST', $_SERVER)) {
printf("<!--%s%s-->\r\n"
- , str_repeat(' ', $spaces)
- , htmlentities($input)
+ , str_repeat(' ', $spaces)
+ , htmlentities($input)
);
} else {
$input = trim($input);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/jtregunna/mod_fastsms/mod_fastsms.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/jtregunna/mod_fastsms/mod_fastsms.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/jtregunna/mod_fastsms/mod_fastsms.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -88,7 +88,7 @@
char* text = NULL;
const char* originator = switch_channel_get_variable(channel, "fastsms_originator");
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
msisdn = switch_core_session_strdup(session, data);
text = strchr(msisdn, ' ');
if (text)
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_odbc_query/mod_odbc_query.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_odbc_query/mod_odbc_query.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_odbc_query/mod_odbc_query.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -95,7 +95,7 @@
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 (!strcasecmp(var, "odbc-dsn") && (!switch_strlen_zero(val))) {
+ if (!strcasecmp(var, "odbc-dsn") && (!zstr(val))) {
globals.odbc_dsn = switch_core_strdup(globals.pool, val);
if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
*odbc_user++ = '\0';
@@ -112,7 +112,7 @@
for (query = switch_xml_child(queries, "query"); query; query = query->next) {
char *var = (char *) switch_xml_attr_soft(query, "name");
char *val = (char *) switch_xml_attr_soft(query, "value");
- if (!switch_strlen_zero(var) && !switch_strlen_zero(val)) {
+ if (!zstr(var) && !zstr(val)) {
switch_core_hash_insert(globals.queries_hash, var, val);
}
}
@@ -172,7 +172,7 @@
return;
}
- if (!data || switch_strlen_zero(data)) {
+ if (!data || zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No query provided!\n");
}
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli (from rev 15313, freeswitch/trunk/contrib/ledr/c/mod_pcli)
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli
Name: svn:mergeinfo
+
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/Makefile
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/Makefile (from rev 15313, freeswitch/trunk/contrib/ledr/c/mod_pcli/Makefile) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/Makefile (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/Makefile 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,2 @@
+BASE=/usr/src/freeswitch/trunk
+include $(BASE)/build/modmake.rules
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/mod_pcli.c
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/mod_pcli.c (from rev 15313, freeswitch/trunk/contrib/ledr/c/mod_pcli/mod_pcli.c) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/mod_pcli.c (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/mod_pcli.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,362 @@
+/*
+ * 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):
+ *
+ * Leon de Rooij <leon@toyos.nl>
+ *
+ *
+ * mod_pcli.c -- PacketCable Lawful Intercept
+ *
+ */
+#include <switch.h>
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_pcli_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_pcli_shutdown);
+SWITCH_MODULE_DEFINITION(mod_pcli, mod_pcli_load, mod_pcli_shutdown, NULL);
+
+SWITCH_STANDARD_APP(pcli_start_function);
+
+typedef enum {
+ PCLI_MEDIA_DIRECTION_UNKNOWN, /* 0 */
+ PCLI_MEDIA_DIRECTION_FROM_TARGET, /* 1 */
+ PCLI_MEDIA_DIRECTION_TO_TARGET, /* 2 */
+ PCLI_MEDIA_DIRECTION_MONO_MODE /* 3 */
+} pcli_media_direction_t;
+
+static struct {
+ switch_memory_pool_t *pool;
+ int switch_id;
+ char *local_addr;
+ int local_port;
+ char *remote_addr;
+ int remote_port;
+ switch_socket_t *socket;
+} pcli_globals;
+
+// temporary declaration here.. remove after testing is done !!!!
+static switch_status_t gen_pcli_header(uint32_t *pcli_header, pcli_media_direction_t media_direction, uint16_t call_id, uint8_t switch_id, uint16_t ini_id);
+
+typedef struct {
+ switch_core_session_t *session;
+ char *ini_id;
+} pcli_session_helper_t;
+
+/* config item validations */
+static switch_xml_config_int_options_t config_opt_valid_switch_id = { SWITCH_TRUE, 0, SWITCH_TRUE, 15 };
+static switch_xml_config_string_options_t config_opt_valid_addr = { NULL, 0, ".+" };
+static switch_xml_config_int_options_t config_opt_valid_port = { SWITCH_TRUE, 0, SWITCH_TRUE, 65535 };
+
+/* config items */
+static switch_xml_config_item_t instructions[] = {
+ SWITCH_CONFIG_ITEM("switch_id", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &pcli_globals.switch_id,
+ (void*)0, &config_opt_valid_switch_id, NULL, NULL),
+ SWITCH_CONFIG_ITEM("local_addr", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &pcli_globals.local_addr,
+ "localhost", &config_opt_valid_addr, NULL, NULL),
+ SWITCH_CONFIG_ITEM("local_port", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &pcli_globals.local_port,
+ (void*)10741, &config_opt_valid_port, NULL, NULL),
+ SWITCH_CONFIG_ITEM("remote_addr", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &pcli_globals.remote_addr,
+ "localhost", &config_opt_valid_addr, NULL, NULL),
+ SWITCH_CONFIG_ITEM("remote_port", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &pcli_globals.remote_port,
+ (void*)10741, &config_opt_valid_port, NULL, NULL),
+ SWITCH_CONFIG_ITEM_END()
+};
+
+/* called at startup and reload of the module */
+static switch_status_t do_config(switch_bool_t reload)
+{
+ switch_socket_t *socket = NULL;
+ switch_sockaddr_t *local_sockaddr;
+ switch_sockaddr_t *remote_sockaddr;
+
+ if (switch_xml_config_parse_module_settings("pcli.conf", reload, instructions) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open pcli.conf\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ /* for now, only init port on startup, fix reload later !! */
+ if (!reload) {
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Trying to create a udp socket !!\n");
+
+ if (switch_sockaddr_info_get(&local_sockaddr, pcli_globals.local_addr, SWITCH_UNSPEC, pcli_globals.local_port, 0, pcli_globals.pool) != SWITCH_STATUS_SUCCESS || !local_sockaddr) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Local Address Error!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (switch_socket_create(&socket, switch_sockaddr_get_family(local_sockaddr), SOCK_DGRAM, 0, pcli_globals.pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Socket Error!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (switch_socket_opt_set(socket, SWITCH_SO_REUSEADDR, 1) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Socket Error!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (switch_socket_bind(socket, local_sockaddr) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Bind Error!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ pcli_globals.socket = socket;
+
+ /* TEST SENDING A PACKET */
+ if (switch_sockaddr_info_get(&remote_sockaddr, pcli_globals.remote_addr, SWITCH_UNSPEC, pcli_globals.remote_port, 0, pcli_globals.pool) != SWITCH_STATUS_SUCCESS || !remote_sockaddr) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Remote Address Error!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ /* create a pcli header */
+ uint32_t pcli_header;
+ pcli_media_direction_t media_direction = PCLI_MEDIA_DIRECTION_FROM_TARGET;
+ uint16_t call_id = 123;
+ uint8_t switch_id = 12;
+ uint16_t ini_id = 10741;
+ gen_pcli_header(&pcli_header, media_direction, call_id, switch_id, ini_id);
+
+ uint32_t network_byte_order_pcli_header;
+ network_byte_order_pcli_header = htonl(pcli_header);
+
+ /* create a pcli body */
+ char *pcli_body = "ABCD";
+
+ /* create a full packet */
+ char *packet;
+ packet = malloc(sizeof(network_byte_order_pcli_header) + sizeof(pcli_body));
+ memcpy(packet, &network_byte_order_pcli_header, sizeof(network_byte_order_pcli_header));
+ memcpy(packet + sizeof(network_byte_order_pcli_header), pcli_body, sizeof(pcli_body));
+
+ size_t packetsize;
+ packetsize = sizeof(packet);
+
+ switch_socket_sendto(pcli_globals.socket, remote_sockaddr, 0, packet, &packetsize);
+
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/* called when SWITCH_EVENT_RELOADXML is sent to this module */
+static void reload_event_handler(switch_event_t *event)
+{
+ do_config(SWITCH_TRUE);
+}
+
+/* generate a PacketCable Lawful Intercept header, that can be prepended to an RTP packet */
+static switch_status_t gen_pcli_header(uint32_t *pcli_header, pcli_media_direction_t media_direction, uint16_t call_id, uint8_t switch_id, uint16_t ini_id)
+{
+ *pcli_header = 0;
+
+ /* some sanity checks */
+
+ if (media_direction > 3) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid media direction, may only be 0-3\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (call_id > 1023) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid call_id, may only be 0-1023\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (switch_id > 15) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid switch_id, may only be 0-15\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ /* ini_id needs no check as it may use the full uint16_t */
+
+ *pcli_header |= (media_direction);
+ *pcli_header |= (call_id << 2);
+ *pcli_header |= (switch_id << 12);
+ *pcli_header |= (ini_id << 16);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_bool_t pcli_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
+{
+// pcli_session_helper_t *pcli_session_helper = (pcli_session_helper_t *) user_data;
+
+ switch (type) {
+ case SWITCH_ABC_TYPE_INIT:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--> INIT\n");
+ break;
+
+ case SWITCH_ABC_TYPE_READ_PING:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--> PING\n");
+ break;
+
+ case SWITCH_ABC_TYPE_CLOSE:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--> CLOSE\n");
+ break;
+
+ case SWITCH_ABC_TYPE_READ:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--> READ\n");
+ break;
+
+ case SWITCH_ABC_TYPE_WRITE:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--> WRITE\n");
+ break;
+
+ case SWITCH_ABC_TYPE_READ_REPLACE:
+ {
+ switch_frame_t *rframe = switch_core_media_bug_get_read_replace_frame(bug);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--> READ_REPLACE seq[%u] ssrc[%lu] packetlen[%lu] rate [%lu] samples [%lu]\n",
+ (unsigned)rframe->seq, (unsigned long)rframe->ssrc, (unsigned long)rframe->packetlen, (unsigned long)rframe->rate, (unsigned long)rframe->samples);
+switch_size_t packetlength = sizeof(rframe->packet);
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, ">>> [%lu]\n", (unsigned long)packetlength);
+
+ }
+ break;
+
+ case SWITCH_ABC_TYPE_WRITE_REPLACE:
+ {
+ switch_frame_t *rframe = switch_core_media_bug_get_write_replace_frame(bug);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--> WRITE_REPLACE seq[%u] ssrc[%lu] packetlen[%lu] rate [%lu] samples[%lu]\n",
+ (unsigned)rframe->seq, (unsigned long)rframe->ssrc, (unsigned long)rframe->packetlen, (unsigned long)rframe->rate, (unsigned long)rframe->samples);
+switch_size_t packetlength = sizeof(rframe->packet);
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, ">>> [%lu]\n", (unsigned long)packetlength);
+
+ }
+ break;
+ }
+
+ return SWITCH_TRUE;
+}
+
+/* necessary for hooking to SWITCH_EVENT_RELOADXML */
+static switch_event_node_t *NODE = NULL;
+
+SWITCH_STANDARD_APP(pcli_start_function)
+{
+ switch_media_bug_t *bug;
+ switch_status_t status;
+ switch_channel_t *channel;
+ pcli_session_helper_t *pcli_session_helper;
+ const char *p;
+
+ if (session == NULL)
+ return;
+
+ channel = switch_core_session_get_channel(session);
+
+ /* Is this channel already set? */
+ bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_pcli_");
+ /* If yes */
+ if (bug != NULL) {
+ /* If we have a stop remove audio bug */
+ if (strcasecmp(data, "stop") == 0) {
+ switch_channel_set_private(channel, "_pcli_", 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");
+
+ return;
+ }
+
+ /* create a new pcli_session_helper */
+ pcli_session_helper = (pcli_session_helper_t *) switch_core_session_alloc(session, sizeof(pcli_session_helper_t));
+
+ /* make session available from pcli_session_helper */
+ pcli_session_helper->session = session;
+
+ /* get LI_ID and store in pcli_session_helper */
+ if ((p = switch_channel_get_variable(channel, "LI_ID")) && switch_true(p)) {
+ pcli_session_helper->ini_id = switch_core_session_strdup(session, p);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No LI_ID was set!\n");
+ return;
+ }
+
+ /* add the bug */
+ //status = switch_core_media_bug_add(session, pcli_callback, pcli_session_helper, 0, SMBF_BOTH, &bug);
+ //status = switch_core_media_bug_add(session, pcli_callback, pcli_session_helper, 0, SMBF_READ_STREAM | SMBF_WRITE_STREAM, &bug);
+ status = switch_core_media_bug_add(session, pcli_callback, pcli_session_helper, 0, SMBF_READ_REPLACE | SMBF_WRITE_REPLACE, &bug);
+ //status = switch_core_media_bug_add(session, pcli_callback, pcli_session_helper, 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;
+ }
+
+ switch_channel_set_private(channel, "_pcli_", bug);
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_pcli_load)
+{
+ switch_application_interface_t *app_interface;
+
+ /* initialize pcli_globals struct */
+ memset(&pcli_globals, 0, sizeof(pcli_globals));
+
+ /* make the pool available from pcli_globals */
+ pcli_globals.pool = pool;
+
+ /* do config */
+ do_config(SWITCH_FALSE);
+
+ /* connect my internal structure to the blank pointer passed to me */
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+ /* make the pcli application available to the system */
+ SWITCH_ADD_APP(app_interface, "pcli", "PacketCable Lawful Intercept", "PacketCable Lawful Intercept", pcli_start_function, "<start>", SAF_NONE);
+
+ /* subscribe to reloadxml event, and hook it to reload_event_handler */
+ if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, reload_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;
+ }
+
+ /* say it */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Lawful Intercept enabled\n");
+
+ /* indicate that the module should continue to be loaded */
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_pcli_shutdown)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "PacketCable Lawful Intercept disabled\n");
+
+/* TODO DESTROY THE SOCKET HERE ! */
+
+ 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:
+ */
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/pcli.conf.xml
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/pcli.conf.xml (from rev 15313, freeswitch/trunk/contrib/ledr/c/mod_pcli/pcli.conf.xml) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/pcli.conf.xml (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/pcli.conf.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,12 @@
+<configuration name="pcli.conf" description="PacketCable Lawful Intercept Configuration">
+
+ <settings>
+ <param name="switch_id" value="0"/>
+ <!-- <param name="method" value="bug"/> -->
+ <param name="local_addr" value="172.31.1.5"/>
+ <param name="local_port" value="8000"/>
+ <param name="remote_addr" value="172.31.1.4"/>
+ <param name="remote_port" value="8000"/>
+ </settings>
+
+</configuration>
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/pcli.structure.mysql
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/pcli.structure.mysql (from rev 15313, freeswitch/trunk/contrib/ledr/c/mod_pcli/pcli.structure.mysql) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/pcli.structure.mysql (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/ledr/c/mod_pcli/pcli.structure.mysql 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,30 @@
+-- TODO: SEEMS TO WORK, BUT VERIFY STILL !
+
+CREATE TABLE IF NOT EXISTS `pcli` (
+ `ini_id` varchar(255) NOT NULL,
+ `count` int(11) NOT NULL,
+UNIQUE KEY `ini_id` (`ini_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+DROP PROCEDURE IF EXISTS get_and_incr_pcli_count;
+delimiter $$
+CREATE PROCEDURE get_and_incr_pcli_count(i VARCHAR(255), OUT c INT)
+BEGIN
+ SET AUTOCOMMIT = 0;
+ START TRANSACTION;
+ SELECT `count` INTO c FROM `pcli` WHERE `ini_id` = i FOR UPDATE;
+ IF (c >= 0) THEN
+ SET c = c + 1;
+ UPDATE `pcli` SET `count` = c WHERE `ini_id` = i;
+ ELSE
+ SET c = 0;
+ INSERT INTO `pcli` (`ini_id`, `count`) VALUES (i, c);
+ END IF;
+ COMMIT;
+END $$
+delimiter ;
+
+-- test with:
+CALL get_and_incr_pcli_count('test', @c);
+SELECT @c AS `count`;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/mod/xml_int/mod_xml_odbc/mod_xml_odbc.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/mod/xml_int/mod_xml_odbc/mod_xml_odbc.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/mod/xml_int/mod_xml_odbc/mod_xml_odbc.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -85,7 +85,7 @@
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
@@ -125,7 +125,7 @@
xml_odbc_session_helper_t *helper = (xml_odbc_session_helper_t *) pArg;
int i, tmp_rowcount;
- if (!switch_strlen_zero(helper->next_template_name)) goto done;
+ if (!zstr(helper->next_template_name)) goto done;
/* loop through all columns and store them in helper->event->headers */
for (i = 0; i < argc; i++) {
@@ -245,7 +245,7 @@
goto done;
}
- if (!switch_strlen_zero(empty_result_break_to) && helper->rowcount == 0) {
+ if (!zstr(empty_result_break_to) && helper->rowcount == 0) {
helper->next_template_name = empty_result_break_to;
}
@@ -265,7 +265,7 @@
if (!strcasecmp(helper->xml_in_cur->name, "xml-odbc-do")) {
char *name = (char *) switch_xml_attr_soft(helper->xml_in_cur, "name");
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ignoring xml-odbc-do because no name is given\n");
goto done;
}
@@ -286,7 +286,7 @@
}
/* just copy xml_in_cur to xml_out */
- if (switch_strlen_zero(helper->xml_out_cur->name)) {
+ if (zstr(helper->xml_out_cur->name)) {
helper->xml_out_cur->name = switch_core_strdup(helper->pool, helper->xml_in_cur->name);
} else if (!(helper->xml_out_cur = switch_xml_add_child_d(helper->xml_out_cur, helper->xml_in_cur->name, helper->xml_out_cur_off++))) {
@@ -324,7 +324,7 @@
/* restore helper->xml_out_cur in case it was changed during render_tag */
helper->xml_out_cur = xml_out_cur_tmp;
- if (!switch_strlen_zero(helper->next_template_name)) goto done;
+ if (!zstr(helper->next_template_name)) goto done;
}
status = SWITCH_STATUS_SUCCESS;
@@ -370,7 +370,7 @@
if ((helper->xml_in_cur = switch_xml_find_child(globals.templates_tag, "template", "name", helper->next_template_name))) {
helper->next_template_name = "";
status = xml_odbc_render_children(helper);
- if (!switch_strlen_zero(helper->next_template_name)) goto reset;
+ if (!zstr(helper->next_template_name)) goto reset;
} else {
helper->next_template_name = "not-found";
goto reset;
@@ -553,7 +553,7 @@
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
- if (!strcasecmp(var, "binding") && !switch_strlen_zero(val)) {
+ if (!strcasecmp(var, "binding") && !zstr(val)) {
if (!(binding = malloc(sizeof(*binding)))) {
goto done;
}
@@ -570,7 +570,7 @@
/* change odbc-dsn to something like odbc-handle with name=default and dsn=a:b:c
* so a linked list or something is created with multiple handles that can be
* selected from xml-odbc-do name=query !!! that would be COOL !!! */
- } else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
globals.odbc_dsn = switch_core_strdup(globals.pool, val);
if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
*odbc_user++ = '\0';
@@ -578,13 +578,13 @@
*odbc_pass++ = '\0';
}
}
- } else if (!strcasecmp(var, "debug") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "debug") && !zstr(val)) {
if (!strcasecmp(val, "true") || !strcasecmp(val, "on")) {
globals.debug = SWITCH_TRUE;
} else {
globals.debug = SWITCH_FALSE;
}
- } else if (!strcasecmp(var, "keep-files-around") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "keep-files-around") && !zstr(val)) {
if (!strcasecmp(val, "true") || !strcasecmp(val, "on")) {
globals.keep_files_around = SWITCH_TRUE;
} else {
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/trixter/README (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/trixter/README 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/trixter/README 2009-11-02 10:10:22 UTC (rev 15314)
@@ -23,6 +23,13 @@
== FILE LIST ==
+scheduled_event.lua
+ LUA script that adds scheduler ability via a MySQL store.
+ Allows for many systems to process events to scale to enterprise capability
+ Events survive switch shutdown, restart, reboot, crash, etc
+ Simple DB schema which allows you to easily integrate into webapps
+
+
apiexec.pl
Execute api commands from the console/cron/windows scheduler/etc
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/trixter/scheduled_event.lua (from rev 15313, freeswitch/trunk/contrib/trixter/scheduled_event.lua) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/trixter/scheduled_event.lua (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/contrib/trixter/scheduled_event.lua 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,199 @@
+-- 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[tm] LUA event scheduler
+--
+-- The Initial Developer of the Original Code is
+-- Bret McDanel <bret AT 0xdecafbad dot com>
+--
+-- Portions created by the Initial Developer are Copyright (C) 2007
+-- the Initial Developer. All Rights Reserved
+--
+-- Contributor(s)
+--
+-- Why use this?
+-- No reason in particular, however if you use sched_api and shut down you lose your scheduled events, by
+-- placing them in a database you get the advantage of them being able to survive a shutdown/crash/reboot/etc
+-- Additionally this script is written in a way to allow for multiple switch boxes to access the same database
+-- and look for events to process, in this way you can scale this to a very large amount of actions
+--
+--
+-- Usage: in FreeSWITCH console or fs_cli,
+-- luarun scheduled_event.lua
+-- starts the script - this is not needed if its auto loaded
+-- luarun scheduled_event.lua <dbuser username> <dbhost hostname> <dbpass password> <dbname database_name>
+-- changes the DB info allowing you to do load management, maintenence, or other things
+-- luarun scheduled_event.lua stop
+-- stops the running script
+--
+-- in lua.conf.xml:
+-- <param name="startup-script" value="scheduled_event.lua"/>
+--
+--
+-- You need to get "mysql.so" for lua and install it in <freeswitch install>/luasql/mysql.so
+-- (or some other place that is in the search path)
+--
+-- Minimal DB schema **AUTOMAGICALLY CREATED IF IT DOES NOT EXIST** (at script start)
+-- CREATE TABLE scheduler (
+-- acctid int(11) NOT NULL auto_increment,
+-- action varchar(1024) NOT NULL,
+-- timestamp timestamp NOT NULL,
+-- server varchar(64) NOT NULL DEFAULT '*',
+-- primary key (acctid)
+-- );
+--
+-- "actions" in the scheduler table should be api commands eg:
+-- insert into scheduler (action,timestamp) values ("pa call 1234",NOW())
+--
+--
+-- Every "heartbeat" events are pulled 1 at a time using write locks on mysql
+-- if your MySQL supports those locks, then only one process can access the DB at a time
+-- events are immediately deleted, and then processed to keep the lock time low
+-- failed events are NOT rescheduled
+-- many boxes can pull events and process them, however I did not attempt to process more
+-- events than time allows for in a given heartbeat interval, some backlog may exist which
+-- may cause this script to totally freak
+
+
+-- currently this script requires http://jira.freeswitch.org/browse/MODAPP-357
+
+ require "luasql.mysql"
+
+ -- Database setup
+ DATABASE = "database"
+ USERNAME = "dbuser"
+ PASSWORD = "het is geheim"
+ DBHOST = "localhost"
+ TABLENAME = "scheduler"
+
+ -- LOGGING
+ LOGLEVEL = "info"
+
+ -- PROGNAME
+ PROGNAME = "scheduled_event.lua"
+
+ function logger(message)
+ freeswitch.console_log(LOGLEVEL,"["..PROGNAME.."] "..message.."\n")
+ end
+
+
+ if argv[1] then
+ i=1
+ while argv[i] do
+ if argv[i] == "stop" then
+ local event = freeswitch.Event("custom", "lua::scheduled_event")
+ event:addHeader("Action", "stop")
+ event:fire()
+ logger("Sent stop message to lua script")
+ return
+ elseif (argv[i] == "dbuser") then
+ i=i+1
+ if argv[i] then
+ logger("Setting DB Username to "..argv[i])
+ USERNAME = argv[i]
+ else
+ logger("You must specify a username!")
+ end
+ elseif (argv[i] == "dbhost") then
+ i=i+1
+ if argv[i] then
+ logger("Setting DB Hostname to "..argv[i])
+ DBHOST = argv[i]
+ else
+ logger("You must specify a hostname!")
+ end
+ elseif (argv[i] == "dbpass") then
+ i=i+1
+ if argv[i] then
+ logger("Setting DB Password to "..argv[i])
+ PASSWORD = argv[i]
+ else
+ logger("You must specify a password!")
+ end
+ elseif (argv[i] == "dbname") then
+ i=i+1
+ if argv[i] then
+ logger("Setting DB to "..argv[i])
+ DATABASE = argv[i]
+ else
+ logger("You must specify a database name!")
+ end
+ end
+ i=i+1
+ end
+ return
+ end
+
+ --Main function starts here
+ logger("Starting")
+
+ -- ensure DB works, create table if it doesnt exist
+ env = assert (luasql.mysql())
+ dbcon = assert (env:connect(DATABASE,USERNAME,PASSWORD,DBHOST))
+ blah = assert(dbcon:execute("CREATE TABLE if not exists "..TABLENAME.." ("..
+ "acctid int(11) NOT NULL auto_increment,"..
+ "action varchar(1024) NOT NULL,"..
+ "timestamp timestamp NOT NULL,"..
+ "server varchar(64) NOT NULL DEFAULT '*',"..
+ "primary key (acctid)"..
+ ")"))
+ dbcon:close()
+ env:close()
+
+ local event_name
+ local event_subclass
+
+ con = freeswitch.EventConsumer("all") -- too lazy to figure out why "heartbeat CUSTOM lua::scheduled_event"
+ -- does not work properly, that is really all we need
+ api = freeswitch.API()
+
+ hostname = api:execute("hostname")
+
+ if blah ~= 0 then
+ logger("Unable to connect to DB or create the table, something is broken.")
+ else
+ for e in (function() return con:pop(1) end) do
+ event_name = e:getHeader("Event-Name") or ""
+ event_subclass = e:getHeader("Event-Subclass") or ""
+
+ if(event_name == "HEARTBEAT") then
+ -- check the system load
+ load = api:execute("status")
+ cur_sessions,rate_sessions,max_rate,max_sessions = string.match(load,"(%d+) session.s. (%d+)/(%d+)\n(%d+) session.s. max")
+ if ((tonumber(cur_sessions) < tonumber(max_sessions)) and (tonumber(rate_sessions) < tonumber(max_rate))) then
+ env = assert (luasql.mysql())
+ dbcon = assert (env:connect(DATABASE,USERNAME,PASSWORD,DBHOST))
+ while true do
+ assert (dbcon:execute("LOCK TABLE "..TABLENAME.." WRITE"))
+ cur = assert (dbcon:execute("select * from "..TABLENAME.." where timestamp < NOW() and (server = '"..hostname.."' or server = '*') order by timestamp limit 1"))
+ row = cur:fetch({},"a")
+ if not row then
+ break
+ end
+ assert(dbcon:execute("delete from "..TABLENAME.." where acctid = "..row.acctid));
+ assert (dbcon:execute("UNLOCK TABLES"))
+ apicmd,apiarg = string.match(row.action,"(%w+) (.*)")
+ api:execute(apicmd,apiarg)
+ end -- while
+ dbcon:close()
+ env:close()
+ end -- rate limiting
+ else if (event_name == "CUSTOM" and event_subclass == "lua::scheduled_event") then
+ action = e:getHeader("Action") or ""
+ if (action == "stop") then
+ logger("got stop message, Exiting")
+ break
+ end
+ end -- not a custom message
+ end -- not a processable event
+ end -- foreach event
+ end -- main loop, DB connection established
\ No newline at end of file
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/control (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/control 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/control 2009-11-02 10:10:22 UTC (rev 15314)
@@ -2,7 +2,7 @@
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
+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
Standards-Version: 3.7.3
Package: freeswitch
@@ -102,7 +102,7 @@
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
Recommends: freeswitch-sounds-en-us-callie-8000
-Suggests: freeswitch-sounds-en-us-callie-16000, freeswitch-sounds-en-us-callie-32000
+Suggests: freeswitch-sounds-en-us-callie-16000, freeswitch-sounds-en-us-callie-32000, freeswitch-sounds-en-us-callie-48000
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
@@ -150,6 +150,16 @@
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
@@ -199,3 +209,55 @@
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-ru
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
+Recommends: freeswitch-sounds-ru-ru-elena-8000
+Suggests: freeswitch-sounds-ru-ru-elena-16000, freeswitch-sounds-ru-ru-elena-32000, freeswitch-sounds-ru-ru-elena-48000
+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-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.
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-lang-ru.conffiles (from rev 15313, freeswitch/trunk/debian/freeswitch-lang-ru.conffiles) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-lang-ru.conffiles (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-lang-ru.conffiles 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,4 @@
+/opt/freeswitch/conf/lang/ru/ru.xml
+/opt/freeswitch/conf/lang/ru/demo/demo.xml
+/opt/freeswitch/conf/lang/ru/vm/sounds.xml
+/opt/freeswitch/conf/lang/ru/vm/tts.xml
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-lang-ru.install (from rev 15313, freeswitch/trunk/debian/freeswitch-lang-ru.install) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-lang-ru.install (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-lang-ru.install 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,4 @@
+opt/freeswitch/conf/lang/ru/*.xml
+opt/freeswitch/conf/lang/ru/demo/*.xml
+opt/freeswitch/conf/lang/ru/vm/*.xml
+opt/freeswitch/mod/mod_say_ru.so*
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-en-us-callie-48000.install (from rev 15313, freeswitch/trunk/debian/freeswitch-sounds-en-us-callie-48000.install) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-en-us-callie-48000.install (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-en-us-callie-48000.install 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/en/us/callie/*/48000/*
+
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-ru-ru-elena-16000.install (from rev 15313, freeswitch/trunk/debian/freeswitch-sounds-ru-ru-elena-16000.install) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-ru-ru-elena-16000.install (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-ru-ru-elena-16000.install 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1 @@
+opt/freeswitch/sounds/ru/RU/elena/*/16000/*
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-ru-ru-elena-32000.install (from rev 15313, freeswitch/trunk/debian/freeswitch-sounds-ru-ru-elena-32000.install) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-ru-ru-elena-32000.install (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-ru-ru-elena-32000.install 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1 @@
+opt/freeswitch/sounds/ru/RU/elena/*/32000/*
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-ru-ru-elena-48000.install (from rev 15313, freeswitch/trunk/debian/freeswitch-sounds-ru-ru-elena-48000.install) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-ru-ru-elena-48000.install (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-ru-ru-elena-48000.install 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1 @@
+opt/freeswitch/sounds/ru/RU/elena/*/48000/*
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-ru-ru-elena-8000.install (from rev 15313, freeswitch/trunk/debian/freeswitch-sounds-ru-ru-elena-8000.install) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-ru-ru-elena-8000.install (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch-sounds-ru-ru-elena-8000.install 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/ru/RU/elena/*/8000/*
+
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch.install (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch.install 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/freeswitch.install 2009-11-02 10:10:22 UTC (rev 15314)
@@ -7,7 +7,6 @@
opt/freeswitch/bin/scripts/*
opt/freeswitch/lib/libfreeswitch*.so*
opt/freeswitch/lib/libopenzap*.so*
-opt/freeswitch/mod/mod_amr*
opt/freeswitch/mod/mod_cidlookup*
opt/freeswitch/mod/mod_curl*
opt/freeswitch/mod/mod_easyroute*
@@ -17,7 +16,6 @@
opt/freeswitch/mod/mod_skypiax*
opt/freeswitch/mod/mod_snom*
opt/freeswitch/mod/mod_spy*
-opt/freeswitch/mod/mod_t38gateway*
opt/freeswitch/mod/mod_vmd*
opt/freeswitch/mod/mod_shout*
opt/freeswitch/mod/mod_cdr_csv.so*
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/rules (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/rules 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/debian/rules 2009-11-02 10:10:22 UTC (rev 15314)
@@ -15,7 +15,7 @@
applications/mod_rss applications/mod_voicemail applications/mod_fsv \
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_t38gateway applications/mod_vmd
+ applications/mod_spy applications/mod_vmd
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
@@ -27,7 +27,7 @@
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 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
+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 \
@@ -106,7 +106,7 @@
dh_clean -k
dh_installdirs -A --sourcedir=debian/tmp
- $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install uhd-sounds-install moh-install
+ $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install cd-sounds-install cd-sounds-ru-install moh-install
# Build architecture-independent files here.
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/docs/ChangeLog (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/docs/ChangeLog 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/docs/ChangeLog 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1,9 +1,20 @@
freeswitch (1.0.5)
+ applications: add inline dp to multiple apps (MODAPP-337/r:14922)
build: Fix build to account for FreeBSD sed issues (FSBUILD-184/r:14479)
build: build unimrcp after sofia (r:14507)
build: Fix mod_ldap not building on Linux (FSBUILD-189/r:14725)
build: add --with-rundir configure param and -run freeswitch runtime param to adjust the location of the pid file (FSBUILD-188/r:14768)
+ build: fix compile on Ubuntu 8.10 (FSCORE-443/r:14928)
+ build: add mod_cidlookup (r:14930)
+ build: fix libtiff build (r:15034)
+ build: CMAKE_MINIMUM_REQUIRED is called too late. (FSBUILD-192/r:15050)
+ build: remove broken modules from debian build (FSBUILD-193/r:15068)
+ build: fix Build-Depends on debian build for skypiax (FSBUILD-197/r:15113)
+ build: Debian build misses some packages (FSBUILD-201/r:15216)
+ 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)
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)
@@ -26,28 +37,149 @@
core: CoreSession::originate: set the uuid on success (r:14773)
core: add optional prefix arg to set_user (FSCORE-429/r:14789)
core: try to improve autoflush and other silly audio glitches from edge cases and help (FSCORE-416/r:14800)
+ 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: 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)
+ core: add i flag to bind_meta_app to do inline execute of the app (not wise to use unless app returns instantly) (r:14969)
+ core: fix using native_file as ringback on codecs that have passthru only (r:14980)
+ 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: 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)
+ core: add bridge_answer_timeout variable, a timeout in seconds how long to tolerate a bridge that is in early media without being answered (can be set on either leg) (r:15057)
+ 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: 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: 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)
+ core: fix arg parsing on restart to not accumulate args (r:15164)
+ 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: 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)
+ core: hangup_after_bridge=false only works if bypass_media=false (FSCORE-417/r:15196)
+ core: add api_on_answer var (r:15207)
+ 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: 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: add record_min_sec chan var (r:15271)
+ docs: Add large Doxygen update (thanks Muhammed Shahzad) (r:14973)
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)
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: 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)
+ libspandsp: update to spandsp snapshot 20091005 (r:15084)
+ libspandsp: update to spandsp-20091006 snapshot (r:15093)
+ libstfu: add resize function (r:14871)
+ mod_alsa: update to new module api (r:14833)
+ 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_cidlookup: add whitepages.com support (r:15023)
+ mod_cidlookup: add channel var / debug log for cidlookup src (r:15268)
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)
mod_commands: add bg_system (like system but in the bg) (r:14746)
mod_commands: add optional trailing & to sched_api to denote running the task in a sep thread (r:14765)
+ mod_commands: fix segfault (r:14961)
+ 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_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_console: Improved tab completions, and more description usage informations (LOGGER-2/r:15103)
+ 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: Fix condition "week of year" calculation (DP-7/r:14968)
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)
+ mod_directory: fix segfault on failure (r:15076)
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: 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_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_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_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_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_h323: initial commit (r:15223)
+ mod_fifo: gracefully fail on missing config file (r:15106)
+ mod_iax: avoiding buffer overflow in silly iax lib (r:14910)
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)
mod_limit: set more chan vars in limit_function (r:14733)
- mod_lua: add conjure-session code and make session available in api commands (r:14739)
+ mod_limit: fix counter-only mode in limit_hash_execute (r:14829)
+ 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_local_stream: add chime-list to local_stream (r:14966)
+ 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)
+ mod_managed: Add utility function to create SWIGTYPE_p objects (r:14923)
+ mod_managed: Add ProgressMediaTime to ChannelVariables (r:15001)
+ 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_portaudio: fix compilation failure in mod_portaudio_stream (MODFORM-35/r:14531)
mod_portaudio: add context param (r:14737)
+ 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_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_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)
+ mod_skypiax: now it accepts a max of 1 call from the same skypename to the same skypename (multiple instances of user A calling multiple instances of user B) each 1.5 seconds (r:14834)
+ mod_skypiax: fires a custom event when an incoming CHATMESSAGE arrives. (r:14845)
+ mod_skypiax: added skypiax_chat command.(r:14857)
+ mod_skypiax: now outbound chatmessages follow the standard path, you can send them with: chat,<proto>|<from>|<to>|<message> or with: skypiax_chat,<interfacename> <to> <text>. (r:14884)
+ 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)
mod_sofia: display the profile name on sofia status gateway xxx (r:14520)
@@ -60,9 +192,63 @@
mod_sofia: add 10 second media timeout waiting for codec establishment (MODSOFIA-22/r:14586)
mod_sofia: Enable creation of sip compact headers from sofia profile configuration (MODENDP-246/r:14698)
mod_sofia: Fix race with hold/unhold in proxy media (FSCORE-432/r:14797)
+ mod_sofia: ATTENTION BEHAVIOR CHANGE... you now have to explicitly set sip_invite_to_params to add params to the to field we will NO longer fall back to sip_invite_params in this case. (FSCORE-433/r:14849)
+ mod_sofia: Fix missing NOTIFY MWI when registering via proxy (MODSOFIA-26/r:14851)
+ mod_sofia: add set funcs for impls (r:14881)
+ mod_sofia: Segfault when receiving 30x response without contact header (MODENDP-247/r:14953)
+ mod_sofia: Added sip_rh_ response header addition capability (MODSOFIA-29/r:14967)
+ mod_sofia: new param force-subscription-domain (r:14971)
+ mod_sofia: improve bad timestamp detection (r:14979)
+ mod_sofia: Override the MWI User@Domain used per user/group/domain (MODENDP-241/r:14987)
+ mod_sofia: set extension=auto_to_user in gateway to make destination equal to user (r:15010)
+ mod_sofia: cover up sofia bug parsing contact strings that do not have <> in them (r:15026)
+ mod_sofia: no more 202 Accepted after REFER since changeset 14701 (MODSOFIA-31/r:15056)
+ mod_sofia: append host when its not supplied on carrot dialing (r:15099)
+ mod_sofia: Fix MESSAGE_QUERY causes event without minimum event information (MODEVENT-58/r:15117)
+ mod_sofia: Add a log message when the invite has no SDP and 3pcc isn't enabled to aid troubleshooting (r:15140)
+ mod_sofia: add variable for one legged 302's via originate so you can tell it happened. (r:15163)
+ mod_sofia: clear up some more display issues and fix resume-media-on-hold sofia option (r:15177)
+ mod_sofia: Fix bridge call seems to hangup as if originator_cancelled when it has not (FSCORE-471/r:15186)
+ mod_sofia: fix issue with resume-media-on-hold and t38 re-invites (r:15187)
+ mod_sofia: Fix RTP destination port is not updated (SFSIP-180/r:15190)
+ mod_sofia: add sip-force-extension (r:15191)
+ mod_sofia: add firing of event after processing re-INVITE (MODENDP-253/r:15205)
+ mod_sofia: record path and template are two values with backwards compatibility tried (r:15208)
+ mod_sofia: make sure dest is not blank for rare edge case (r:15212)
+ mod_sofia: Fix seg where INVITE w/o SDP + FS 3pcc-proxy + B leg has early media (MODSOFIA-33/r:15214)
+ mod_sofia: sql-in-transactions profile param (only vaid on first load) whether or not to bundle sql stmts in transactions (r:15217)
+ 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_syslog: Enable mod_syslog to log to a specific facility (LOGGER-3/r:15162)
+ 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: 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_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)
+ mod_valet_parking: add auto ext type and support for being called from bind_meta_app to valet_parking (needs some more) (r:15145)
+ mod_valet_parking: add sleep to inline dp to make xfer to valet wait a second (r:15168)
+ 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_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_voipcodecs: move mod_voipcodecs to use spandsp instead of libvoipcodecs - windows (r:15088)
+ 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_rpc: Fix auth issue (XMLINT-54/r:14580)
+ phrases: Add Recursive phrases support (FSCORE-458/r:15101)
+ support: add fscore_pb script for dumping core info directly to pastebin (r:14904)
switch_utils: add a host lookup func (r:14653)
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/docs/phrase/phrase_en.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/docs/phrase/phrase_en.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/docs/phrase/phrase_en.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -219,6 +219,25 @@
<prompt phrase="urgent" filename="vm-urgent.wav"/>
<prompt phrase="That mailbox is full. Please try your call again later." filename="vm-mailbox_full.wav"/>
</voicemail>
+ <directory>
+ <prompt phrase="Please enter the first few letters of the persons" filename="dir-enter-person.wav"/>
+ <prompt phrase="last name." filename="dir-last_name.wav"/>
+ <prompt phrase="To search by" filename="dir-to_search_by.wav"/>
+ <prompt phrase="first name." filename="dir-first_name.wav"/>
+ <prompt phrase="Your search matched no results, try again." filename="dir-no_match_entry.wav"/>
+ <prompt phrase="results matched your search." filename="dir-result_match.wav"/>
+ <prompt phrase="Your search returned too many results, please try again." filename="dir-to_many_result.wav"/>
+ <prompt phrase="No more results." filename="dir-no_more_result.wav"/>
+ <prompt phrase="Result number." filename="dir-result_number.wav"/>
+ <prompt phrase="at extension" filename="dir-at_extension.wav"/>
+ <prompt phrase="To select this entry" filename="dir-to_select_entry.wav"/>
+ <prompt phrase="For the next entry" filename="dir-for_next.wav"/>
+ <prompt phrase="For the previous entry" filename="dir-for_prev.wav"/>
+ <prompt phrase="To start a new search" filename="dir-to_make_new_search.wav"/>
+ <prompt phrase="You need to specify a minimum of" filename="dir-specify_mininum_first.wav"/>
+ <prompt phrase="letters of the person name, try again." filename="dir-letters_of_person_name.wav"/>
+ <prompt phrase="press" filename="dir-press.wav"/>
+ </directory>
<conference>
<prompt phrase="NULL" filename="conf-ack.wav" type="tone"/>
<prompt phrase="NULL" filename="conf-nack.wav" type="tone"/>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/docs/phrase/phrase_fr.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/docs/phrase/phrase_fr.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/docs/phrase/phrase_fr.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -218,7 +218,26 @@
<prompt phrase="pour répondre à cet appel tout de suite" filename="vm-return_call.wav"/>
<prompt phrase="urgent" filename="vm-urgent.wav"/>
</voicemail>
- <conference>
+ <directory>
+ <prompt phrase="Veuillez entrer les premiere lettre du" filename="dir-enter-person.wav"/>
+ <prompt phrase="nom de famille." filename="dir-last_name.wav"/>
+ <prompt phrase="Pour chercher par" filename="dir-to_search_by.wav"/>
+ <prompt phrase="prénom." filename="dir-first_name.wav"/>
+ <prompt phrase="Votre recherche a retourner aucune résultat, essayer de nouveaux." filename="dir-no_match_entry.wav"/>
+ <prompt phrase="résultats correspond a votre recherche." filename="dir-result_match.wav"/>
+ <prompt phrase="Votre recherche retourne trop de résultat, essayer de nouveaux." filename="dir-to_many_result.wav"/>
+ <prompt phrase="Fin des résultats." filename="dir-no_more_result.wav"/>
+ <prompt phrase="Résultat numéro" filename="dir-result_number.wav"/>
+ <prompt phrase="aux poste" filename="dir-at_extension.wav"/>
+ <prompt phrase="Pour selectionner ce nom" filename="dir-to_select_entry.wav"/>
+ <prompt phrase="Pour le nom suivant" filename="dir-for_next.wav"/>
+ <prompt phrase="Pour le nom précédent" filename="dir-for_prev.wav"/>
+ <prompt phrase="Pour faire une nouvelle recherche" filename="dir-to_make_new_search.wav"/>
+ <prompt phrase="Vous devez entré au minimum" filename="dir-specify_mininum_first.wav"/>
+ <prompt phrase="lettre du nom de la personne, essayer de nouveaux." filename="dir-letters_of_person_name.wav"/>
+ <prompt phrase="Appuyez" filename="dir-press.wav"/>
+ </directory>
+ <conference>
<prompt phrase="NULL" filename="conf-ack.wav" type="tone"/>
<prompt phrase="NULL" filename="conf-nack.wav" type="tone"/>
<prompt phrase="Personne ne peut vous entendre." filename="conf-mute.wav"/>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/freeswitch.spec (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/freeswitch.spec 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/freeswitch.spec 2009-11-02 10:10:22 UTC (rev 15314)
@@ -314,7 +314,7 @@
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_fsv applications/mod_lcr applications/mod_easyroute applications/mod_stress applications/mod_vmd applications/mod_limit applications/mod_soundtouch applications/mod_fax"
+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"
DIALPLANS_MODULES="dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml"
DIRECTORIES_MODULES=""
@@ -541,6 +541,7 @@
%{prefix}/mod/mod_limit.so*
%{prefix}/mod/mod_rss.so*
%{prefix}/mod/mod_voicemail.so*
+%{prefix}/mod/mod_directory.so*
%{prefix}/mod/mod_pocketsphinx.so*
%{prefix}/mod/mod_flite.so*
%{prefix}/mod/mod_ilbc.so*
@@ -592,7 +593,7 @@
%{prefix}/mod/ozmod_analog_em.so*
%{prefix}/mod/ozmod_isdn.so*
%{prefix}/mod/ozmod_skel.*
-%{prefix}/mod/ozmod_ss7_boost.so*
+%{prefix}/mod/ozmod_sangoma_boost.so*
%{prefix}/mod/ozmod_zt.so*
%files codec-passthru-amrwb
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/esl/php/Makefile (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/esl/php/Makefile 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/esl/php/Makefile 2009-11-02 10:10:22 UTC (rev 15314)
@@ -26,5 +26,5 @@
install: ESL.so
cp ESL.so $(shell php-config --extension-dir)
- cp ESL.php $(shell php -r 'phpinfo();' | grep include_path | cut -d: -f2)
+ cp ESL.php $(shell php -r 'echo ini_get("include_path");' | cut -d: -f2)
echo 'extension=ESL.so' > $(shell php-config --configure-options | tr " " "\n" | grep -- --with-config-file-scan-dir | cut -f2 -d=)/esl.ini
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/esl/src/esl_event.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/esl/src/esl_event.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/esl/src/esl_event.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -128,6 +128,7 @@
"NAT",
"RECORD_START",
"RECORD_STOP",
+ "CALL_UPDATE",
"ALL"
};
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/esl/src/include/esl_event.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/esl/src/include/esl_event.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/esl/src/include/esl_event.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -116,6 +116,7 @@
ESL_EVENT_NAT,
ESL_EVENT_RECORD_START,
ESL_EVENT_RECORD_STOP,
+ ESL_EVENT_CALL_UPDATE,
ESL_EVENT_ALL
} esl_event_types_t;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -943,14 +943,19 @@
SU_DEBUG_5(("nua(%p): %s: %s %s in %u %s\n", \
(void *)nh, cr->cr_method_name, (m), received, status, phrase))
+ retry:
+
if (!ss || !sip || 300 <= status)
/* Xyzzy */;
else if (!session_get_description(sip, &sdp, &len))
/* No SDP */;
else if (cr->cr_answer_recv) {
/* Ignore spurious answers after completing O/A */
- LOG3("ignoring duplicate");
- sdp = NULL;
+ //LOG3("ignoring duplicate");
+ //sdp = NULL;
+ // we need to make sure its *actually* a dup, so we can't assume for now.
+ cr->cr_answer_recv = 0;
+ goto retry;
}
else if (cr->cr_offer_sent) {
/* case 1: answer to our offer */
@@ -3490,8 +3495,9 @@
if ((overlap = sr0->sr_offer_recv && !sr0->sr_answer_sent))
break;
- if (nh->nh_soa && overlap)
- return nua_server_retry_after(sr, 500, "Overlapping Offer/Answer", 1, 9);
+ if (nh->nh_soa && overlap) {
+ return nua_server_retry_after(sr, 500, "Overlapping Offer/Answer", 1, 9);
+ }
if (nh->nh_soa &&
soa_set_remote_sdp(nh->nh_soa, NULL, sr->sr_sdp, sr->sr_sdp_len) < 0) {
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/.update (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/.update 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/.update 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1 +1 @@
-Wed Oct 1 00:08:32 EDT 2008
+Mon Oct 5 12:03:35 CDT 2009
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/configure.ac (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/configure.ac 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/configure.ac 2009-11-02 10:10:22 UTC (rev 15314)
@@ -16,7 +16,7 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
-# $Id: configure.ac,v 1.71 2009/07/12 09:29:18 steveu Exp $
+# $Id: configure.ac,v 1.73 2009/10/03 04:37:25 steveu Exp $
# @start 1
@@ -108,6 +108,22 @@
CXXFLAGS=${CXXFLAGS-"-g -O2"}
fi
+AC_DEFUN([REMOVE_FROM_VAR],[
+ new_val=""
+ removed=0
+ for i in $$1; do
+ if test "x$i" != "x$2"; then
+ new_val="$new_val $i"
+ else
+ removed=1
+ fi
+ done
+ if test $removed = "1"; then
+ echo " removed \"$2\" from $1"
+ $1=$new_val
+ fi
+])
+
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
@@ -130,10 +146,10 @@
AC_ARG_ENABLE(sse4a, [ --enable-sse4a Enable SSE4A support])
AC_ARG_ENABLE(sse5, [ --enable-sse5 Enable SSE5 support])
AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support])
+# The following is for MSVC, where we may be using a local copy of libtiff, built alongside spandsp
AC_ARG_ENABLE(builtin_tiff,
-[AC_HELP_STRING([--enable-builtin-tiff],[build with builtin libtiff])],[enable_builtin_tiff="$enableval"],[enable_builtin_tiff="no"])
+ [AC_HELP_STRING([--enable-builtin-tiff],[build with builtin libtiff])],[enable_builtin_tiff="$enableval"],[enable_builtin_tiff="no"])
-
AC_FUNC_ERROR_AT_LINE
AC_FUNC_VPRINTF
AC_FUNC_MALLOC
@@ -344,6 +360,7 @@
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
fi
COMP_VENDOR_LDFLAGS=
+ REMOVE_FROM_VAR(CFLAGS, -Xc)
;;
*)
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/spandsp/fax-tests.dtd (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/spandsp/fax-tests.dtd 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/spandsp/fax-tests.dtd 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1,6 +1,7 @@
<!-- FAX test scripts -->
<!ELEMENT fax-tests (config|messages|test-group)* >
<!ELEMENT config (path)* >
+<!ELEMENT path (EMPTY)* >
<!ATTLIST path
type CDATA #REQUIRED
value CDATA #REQUIRED
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/spandsp-sim/line_model.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/spandsp-sim/line_model.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/spandsp-sim/line_model.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: line_model.c,v 1.12 2009/06/01 16:27:12 steveu Exp $
+ * $Id: line_model.c,v 1.14 2009/09/23 16:02:59 steveu Exp $
*/
#if defined(HAVE_CONFIG_H)
@@ -54,7 +54,7 @@
#define NULL (void *) 0
#endif
-float null_line_model[] =
+static const float null_line_model[] =
{
0.0,
0.0,
@@ -187,7 +187,7 @@
1.0
};
-static float *models[] =
+SPAN_DECLARE_DATA const float *line_models[] =
{
null_line_model, /* 0 */
proakis_line_model,
@@ -225,7 +225,7 @@
s->near_buf_ptr = p;
/* Apply the filter */
- sum = 0;
+ sum = 0.0f;
for (j = 0; j < s->near_filter_len; j++)
{
sum += s->near_filter[j]*s->near_buf[p];
@@ -254,7 +254,7 @@
s->far_buf_ptr = p;
/* Apply the filter */
- sum = 0;
+ sum = 0.0f;
for (j = 0; j < s->far_filter_len; j++)
{
sum += s->far_filter[j]*s->far_buf[p];
@@ -479,10 +479,10 @@
s->munge = codec_munge_init(codec, rbs_pattern);
- s->near_filter = models[model];
+ s->near_filter = line_models[model];
s->near_filter_len = 129;
- s->far_filter = models[model];
+ s->far_filter = line_models[model];
s->far_filter_len = 129;
/* Put half the noise in each analogue section */
@@ -526,14 +526,14 @@
s->line1.bulk_delay_ptr = 0;
s->line2.bulk_delay_ptr = 0;
- s->line1.near_filter = models[model1];
+ s->line1.near_filter = line_models[model1];
s->line1.near_filter_len = 129;
- s->line2.near_filter = models[model2];
+ s->line2.near_filter = line_models[model2];
s->line2.near_filter_len = 129;
- s->line1.far_filter = models[model1];
+ s->line1.far_filter = line_models[model1];
s->line1.far_filter_len = 129;
- s->line2.far_filter = models[model2];
+ s->line2.far_filter = line_models[model2];
s->line2.far_filter_len = 129;
/* Put half the noise in each analogue section */
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/spandsp-sim/make_line_models.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/spandsp-sim/make_line_models.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/spandsp-sim/make_line_models.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: make_line_models.c,v 1.9 2009/02/10 17:49:20 steveu Exp $
+ * $Id: make_line_models.c,v 1.10 2009/09/23 16:02:59 steveu Exp $
*/
/*! \page make_line_models_page Telephony line model construction
@@ -849,7 +849,8 @@
offset = (f - edd[l - 1].freq)/(edd[l].freq - edd[l - 1].freq);
delay = (1.0f - offset)*edd[l - 1].edd[k] + offset*edd[l].edd[k];
}
- phase = 2.0f*M_PI*f*delay*0.001f;
+ //phase = 2.0f*M_PI*f*delay*0.001f;
+ phase = 0.0f;
#if defined(HAVE_FFTW3_H)
in[i][0] = amp*cosf(phase);
in[i][1] = amp*sinf(phase);
@@ -874,7 +875,7 @@
fprintf(outfile, "/* V.56bis AD-%d, EDD%d */\n", (j == 0) ? 1 : j + 4, k + 1);
- fprintf(outfile, "float ad_%d_edd_%d_model[] =\n", (j == 0) ? 1 : j + 4, k + 1);
+ fprintf(outfile, "const float ad_%d_edd_%d_model[] =\n", (j == 0) ? 1 : j + 4, k + 1);
fprintf(outfile, "{\n");
/* Normalise the filter's gain */
pw = 0.0f;
@@ -955,7 +956,8 @@
/* Linear interpolation */
amp = ((1.0f - offset)*proakis[index].amp + offset*proakis[index + 1].amp)/2.3f;
delay = (1.0f - offset)*proakis[index].delay + offset*proakis[index + 1].delay;
- phase = 2.0f*M_PI*f*delay*0.001f;
+ //phase = 2.0f*M_PI*f*delay*0.001f;
+ phase = 0.0f;
#if defined(HAVE_FFTW3_H)
in[i][0] = amp*cosf(phase);
in[i][1] = amp*sinf(phase);
@@ -978,7 +980,7 @@
fprintf(outfile, "/* Medium range telephone line response\n");
fprintf(outfile, " (from p 537, Digital Communication, John G. Proakis */\n");
- fprintf(outfile, "float proakis_line_model[] =\n");
+ fprintf(outfile, "const float proakis_line_model[] =\n");
fprintf(outfile, "{\n");
/* Normalise the filter's gain */
pw = 0.0f;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/spandsp-sim/spandsp/line_model.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/spandsp-sim/spandsp/line_model.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/spandsp-sim/spandsp/line_model.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.6 2009/05/31 14:47:10 steveu Exp $
+ * $Id: line_model.h,v 1.7 2009/09/23 16:02:59 steveu Exp $
*/
/*! \file */
@@ -132,6 +132,8 @@
{
#endif
+SPAN_DECLARE_DATA extern const float *line_models[];
+
SPAN_DECLARE(void) both_ways_line_model(both_ways_line_model_state_t *s,
int16_t output1[],
const int16_t input1[],
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/Makefile.am (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/Makefile.am 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/Makefile.am 2009-11-02 10:10:22 UTC (rev 15314)
@@ -16,7 +16,7 @@
## 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.135 2009/07/12 09:23:09 steveu Exp $
+## $Id: Makefile.am,v 1.137 2009/09/22 14:52:31 steveu Exp $
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
@@ -110,6 +110,7 @@
silence_gen.c \
super_tone_rx.c \
super_tone_tx.c \
+ swept_tone.c \
t4.c \
t30.c \
t30_api.c \
@@ -188,6 +189,7 @@
spandsp/silence_gen.h \
spandsp/super_tone_rx.h \
spandsp/super_tone_tx.h \
+ spandsp/swept_tone.h \
spandsp/t4.h \
spandsp/t30.h \
spandsp/t30_api.h \
@@ -226,6 +228,7 @@
spandsp/private/bert.h \
spandsp/private/bitstream.h \
spandsp/private/dtmf.h \
+ spandsp/private/echo.h \
spandsp/private/fax.h \
spandsp/private/fax_modems.h \
spandsp/private/fsk.h \
@@ -238,6 +241,7 @@
spandsp/private/logging.h \
spandsp/private/lpc10.h \
spandsp/private/modem_connect_tones.h \
+ spandsp/private/modem_echo.h \
spandsp/private/noise.h \
spandsp/private/oki_adpcm.h \
spandsp/private/queue.h \
@@ -246,6 +250,7 @@
spandsp/private/silence_gen.h \
spandsp/private/super_tone_rx.h \
spandsp/private/super_tone_tx.h \
+ spandsp/private/swept_tone.h \
spandsp/private/t30.h \
spandsp/private/t31.h \
spandsp/private/t38_core.h \
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/at_interpreter.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/at_interpreter.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/at_interpreter.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.40 2009/07/10 13:15:56 steveu Exp $
+ * $Id: at_interpreter.c,v 1.41 2009/10/03 04:37:25 steveu Exp $
*/
/*! \file */
@@ -34,6 +34,10 @@
#include "config.h"
#endif
+#if defined(__sun)
+#define __EXTENSIONS__
+#endif
+
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
@@ -76,7 +80,7 @@
static at_profile_t profiles[3] =
{
{
-#if defined(_MSC_VER) || defined(__sunos) || defined(__solaris)
+#if defined(_MSC_VER) || defined(__sunos) || defined(__solaris) || defined(__sun)
/*.echo =*/ TRUE,
/*.verbose =*/ TRUE,
/*.result_code_format =*/ ASCII_RESULT_CODES,
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/echo.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/echo.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/echo.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -27,7 +27,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: echo.c,v 1.32 2009/02/10 13:06:46 steveu Exp $
+ * $Id: echo.c,v 1.33 2009/09/22 13:11:04 steveu Exp $
*/
/*! \file */
@@ -102,6 +102,8 @@
#include "spandsp/bit_operations.h"
#include "spandsp/echo.h"
+#include "spandsp/private/echo.h"
+
#if !defined(NULL)
#define NULL (void *) 0
#endif
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/fax.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/fax.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/fax.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.93 2009/05/24 07:18:36 steveu Exp $
+ * $Id: fax.c,v 1.94 2009/09/04 14:38:46 steveu Exp $
*/
/*! \file */
@@ -128,9 +128,13 @@
}
/*- End of function --------------------------------------------------------*/
-static void set_rx_handler(fax_state_t *s, span_rx_handler_t *handler, void *user_data)
+static void set_rx_handler(fax_state_t *s,
+ span_rx_handler_t *rx_handler,
+ span_rx_fillin_handler_t *fillin_handler,
+ void *user_data)
{
- s->modems.rx_handler = handler;
+ s->modems.rx_handler = rx_handler;
+ s->modems.rx_fillin_handler = fillin_handler;
s->modems.rx_user_data = user_data;
}
/*- End of function --------------------------------------------------------*/
@@ -162,7 +166,7 @@
/* The fast modem has trained, so we no longer need to run the slow
one in parallel. */
span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx));
- set_rx_handler(t, (span_rx_handler_t *) &v17_rx, &s->v17_rx);
+ set_rx_handler(t, (span_rx_handler_t *) &v17_rx, (span_rx_fillin_handler_t *) &v17_rx_fillin, &s->v17_rx);
}
else
{
@@ -172,13 +176,26 @@
/* We have received something, and the fast modem has not trained. We must
be receiving valid V.21 */
span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
- set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
+ set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx);
}
}
return 0;
}
/*- End of function --------------------------------------------------------*/
+static int v17_v21_rx_fillin(void *user_data, int len)
+{
+ fax_state_t *t;
+ fax_modems_state_t *s;
+
+ t = (fax_state_t *) user_data;
+ s = &t->modems;
+ v17_rx_fillin(&s->v17_rx, len);
+ fsk_rx_fillin(&s->v21_rx, len);
+ return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len)
{
fax_state_t *t;
@@ -192,7 +209,7 @@
/* The fast modem has trained, so we no longer need to run the slow
one in parallel. */
span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx));
- set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, &s->v27ter_rx);
+ set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, (span_rx_fillin_handler_t *) &v27ter_rx_fillin, &s->v27ter_rx);
}
else
{
@@ -202,13 +219,26 @@
/* We have received something, and the fast modem has not trained. We must
be receiving valid V.21 */
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
- set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
+ set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx);
}
}
return 0;
}
/*- End of function --------------------------------------------------------*/
+static int v27ter_v21_rx_fillin(void *user_data, int len)
+{
+ fax_state_t *t;
+ fax_modems_state_t *s;
+
+ t = (fax_state_t *) user_data;
+ s = &t->modems;
+ v27ter_rx_fillin(&s->v27ter_rx, len);
+ fsk_rx_fillin(&s->v21_rx, len);
+ return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
static int v29_v21_rx(void *user_data, const int16_t amp[], int len)
{
fax_state_t *t;
@@ -222,7 +252,7 @@
/* The fast modem has trained, so we no longer need to run the slow
one in parallel. */
span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx));
- set_rx_handler(t, (span_rx_handler_t *) &v29_rx, &s->v29_rx);
+ set_rx_handler(t, (span_rx_handler_t *) &v29_rx, (span_rx_fillin_handler_t *) &v29_rx_fillin, &s->v29_rx);
}
else
{
@@ -232,13 +262,26 @@
/* We have received something, and the fast modem has not trained. We must
be receiving valid V.21 */
span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
- set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
+ set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx);
}
}
return 0;
}
/*- End of function --------------------------------------------------------*/
+static int v29_v21_rx_fillin(void *user_data, int len)
+{
+ fax_state_t *t;
+ fax_modems_state_t *s;
+
+ t = (fax_state_t *) user_data;
+ s = &t->modems;
+ v29_rx_fillin(&s->v29_rx, len);
+ fsk_rx_fillin(&s->v21_rx, len);
+ return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
SPAN_DECLARE(int) fax_rx(fax_state_t *s, int16_t *amp, int len)
{
int i;
@@ -276,26 +319,9 @@
write(s->modems.audio_rx_log, amp, len*sizeof(int16_t));
}
#endif
+ /* Call the fillin function of the current modem (if there is one). */
+ s->modems.rx_fillin_handler(s->modems.rx_user_data, len);
t30_timer_update(&s->t30, len);
- /* Call the fillin function of the current modem (if there is one). */
- switch (s->modems.current_rx_type)
- {
- case T30_MODEM_V21:
- len = fsk_rx_fillin(&s->modems.v21_rx, len);
- break;
- case T30_MODEM_V27TER:
- /* TODO: what about FSK in the early stages */
- len = v27ter_rx_fillin(&s->modems.v27ter_rx, len);
- break;
- case T30_MODEM_V29:
- /* TODO: what about FSK in the early stages */
- len = v29_rx_fillin(&s->modems.v29_rx, len);
- break;
- case T30_MODEM_V17:
- /* TODO: what about FSK in the early stages */
- len = v17_rx_fillin(&s->modems.v17_rx, len);
- break;
- }
return len;
}
/*- End of function --------------------------------------------------------*/
@@ -399,27 +425,27 @@
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_signal_cutoff(&t->v21_rx, -45.5f);
- set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, &t->v21_rx);
+ set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &t->v21_rx);
break;
case T30_MODEM_V27TER:
v27ter_rx_restart(&t->v27ter_rx, bit_rate, FALSE);
v27ter_rx_set_put_bit(&t->v27ter_rx, put_bit_func, put_bit_user_data);
- set_rx_handler(s, &v27ter_v21_rx, s);
+ set_rx_handler(s, &v27ter_v21_rx, &v27ter_v21_rx_fillin, s);
break;
case T30_MODEM_V29:
v29_rx_restart(&t->v29_rx, bit_rate, FALSE);
v29_rx_set_put_bit(&t->v29_rx, put_bit_func, put_bit_user_data);
- set_rx_handler(s, &v29_v21_rx, s);
+ set_rx_handler(s, &v29_v21_rx, &v29_v21_rx_fillin, s);
break;
case T30_MODEM_V17:
v17_rx_restart(&t->v17_rx, bit_rate, short_train);
v17_rx_set_put_bit(&t->v17_rx, put_bit_func, put_bit_user_data);
- set_rx_handler(s, &v17_v21_rx, s);
+ set_rx_handler(s, &v17_v21_rx, &v17_v21_rx_fillin, s);
break;
case T30_MODEM_DONE:
span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n");
default:
- set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, s);
+ set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s);
break;
}
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/fax_modems.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/fax_modems.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/fax_modems.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.5 2009/04/12 03:29:58 steveu Exp $
+ * $Id: fax_modems.c,v 1.7 2009/10/05 16:33:25 steveu Exp $
*/
/*! \file */
@@ -45,9 +45,6 @@
#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"
@@ -101,6 +98,7 @@
be receiving valid V.21 */
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
s->rx_handler = (span_rx_handler_t *) &fsk_rx;
+ s->rx_fillin_handler = (span_rx_fillin_handler_t *) &fsk_rx_fillin;
s->rx_user_data = &s->v21_rx;
}
return 0;
@@ -131,6 +129,7 @@
be receiving valid V.21 */
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
s->rx_handler = (span_rx_handler_t *) &fsk_rx;
+ s->rx_fillin_handler = (span_rx_fillin_handler_t *) &fsk_rx_fillin;
s->rx_user_data = &s->v21_rx;
}
return 0;
@@ -161,6 +160,7 @@
be receiving valid V.21 */
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
s->rx_handler = (span_rx_handler_t *) &fsk_rx;
+ s->rx_fillin_handler = (span_rx_fillin_handler_t *) &fsk_rx_fillin;
s->rx_user_data = &s->v21_rx;
}
return 0;
@@ -196,6 +196,7 @@
case SIG_STATUS_TRAINING_SUCCEEDED:
span_log(&s->logging, SPAN_LOG_FLOW, "Switching to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx));
s->rx_handler = (span_rx_handler_t *) &v17_rx;
+ s->rx_fillin_handler = (span_rx_fillin_handler_t *) &v17_rx_fillin;
s->rx_user_data = &s->v17_rx;
break;
}
@@ -212,6 +213,7 @@
case SIG_STATUS_TRAINING_SUCCEEDED:
span_log(&s->logging, SPAN_LOG_FLOW, "Switching to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx));
s->rx_handler = (span_rx_handler_t *) &v27ter_rx;
+ s->rx_fillin_handler = (span_rx_fillin_handler_t *) &v27ter_rx_fillin;
s->rx_user_data = &s->v27ter_rx;
break;
}
@@ -228,6 +230,7 @@
case SIG_STATUS_TRAINING_SUCCEEDED:
span_log(&s->logging, SPAN_LOG_FLOW, "Switching to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx));
s->rx_handler = (span_rx_handler_t *) &v29_rx;
+ s->rx_fillin_handler = (span_rx_fillin_handler_t *) &v29_rx_fillin;
s->rx_user_data = &s->v29_rx;
break;
}
@@ -300,6 +303,7 @@
s->rx_signal_present = FALSE;
s->rx_handler = (span_rx_handler_t *) &span_dummy_rx;
+ s->rx_fillin_handler = (span_rx_fillin_handler_t *) &span_dummy_rx;
s->rx_user_data = NULL;
s->tx_handler = (span_tx_handler_t *) &silence_gen;
s->tx_user_data = &s->silence_gen;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/filter_tools.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/filter_tools.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/filter_tools.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: filter_tools.c,v 1.10 2009/02/10 17:16:57 steveu Exp $
+ * $Id: filter_tools.c,v 1.11 2009/10/05 16:33:25 steveu Exp $
*/
#if defined(HAVE_CONFIG_H)
@@ -34,7 +34,6 @@
#include <inttypes.h>
#include <stdlib.h>
-#include <unistd.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/libspandsp.2005.vcproj (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/libspandsp.2005.vcproj 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/libspandsp.2005.vcproj 2009-11-02 10:10:22 UTC (rev 15314)
@@ -142,6 +142,7 @@
<File RelativePath="silence_gen.c"></File>
<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="t30.c"></File>
<File RelativePath="t30_api.c"></File>
@@ -219,6 +220,7 @@
<File RelativePath="spandsp/silence_gen.h"></File>
<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/t30.h"></File>
<File RelativePath="spandsp/t30_api.h"></File>
@@ -257,6 +259,7 @@
<File RelativePath="spandsp/private/bert.h"></File>
<File RelativePath="spandsp/private/bitstream.h"></File>
<File RelativePath="spandsp/private/dtmf.h"></File>
+<File RelativePath="spandsp/private/echo.h"></File>
<File RelativePath="spandsp/private/fax.h"></File>
<File RelativePath="spandsp/private/fax_modems.h"></File>
<File RelativePath="spandsp/private/fsk.h"></File>
@@ -269,6 +272,7 @@
<File RelativePath="spandsp/private/logging.h"></File>
<File RelativePath="spandsp/private/lpc10.h"></File>
<File RelativePath="spandsp/private/modem_connect_tones.h"></File>
+<File RelativePath="spandsp/private/modem_echo.h"></File>
<File RelativePath="spandsp/private/noise.h"></File>
<File RelativePath="spandsp/private/oki_adpcm.h"></File>
<File RelativePath="spandsp/private/queue.h"></File>
@@ -277,6 +281,7 @@
<File RelativePath="spandsp/private/silence_gen.h"></File>
<File RelativePath="spandsp/private/super_tone_rx.h"></File>
<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/t31.h"></File>
<File RelativePath="spandsp/private/t38_core.h"></File>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/libspandsp.2008.vcproj (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/libspandsp.2008.vcproj 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/libspandsp.2008.vcproj 2009-11-02 10:10:22 UTC (rev 15314)
@@ -212,6 +212,7 @@
<File RelativePath="silence_gen.c"></File>
<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="t30.c"></File>
<File RelativePath="t30_api.c"></File>
@@ -289,6 +290,7 @@
<File RelativePath="spandsp/silence_gen.h"></File>
<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/t30.h"></File>
<File RelativePath="spandsp/t30_api.h"></File>
@@ -327,6 +329,7 @@
<File RelativePath="spandsp/private/bert.h"></File>
<File RelativePath="spandsp/private/bitstream.h"></File>
<File RelativePath="spandsp/private/dtmf.h"></File>
+<File RelativePath="spandsp/private/echo.h"></File>
<File RelativePath="spandsp/private/fax.h"></File>
<File RelativePath="spandsp/private/fax_modems.h"></File>
<File RelativePath="spandsp/private/fsk.h"></File>
@@ -339,6 +342,7 @@
<File RelativePath="spandsp/private/logging.h"></File>
<File RelativePath="spandsp/private/lpc10.h"></File>
<File RelativePath="spandsp/private/modem_connect_tones.h"></File>
+<File RelativePath="spandsp/private/modem_echo.h"></File>
<File RelativePath="spandsp/private/noise.h"></File>
<File RelativePath="spandsp/private/oki_adpcm.h"></File>
<File RelativePath="spandsp/private/queue.h"></File>
@@ -347,6 +351,7 @@
<File RelativePath="spandsp/private/silence_gen.h"></File>
<File RelativePath="spandsp/private/super_tone_rx.h"></File>
<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/t31.h"></File>
<File RelativePath="spandsp/private/t38_core.h"></File>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/libspandsp.dsp (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/libspandsp.dsp 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/libspandsp.dsp 2009-11-02 10:10:22 UTC (rev 15314)
@@ -293,6 +293,10 @@
# End Source File
# Begin Source File
+SOURCE=.\swept_tone.c
+# End Source File
+# Begin Source File
+
SOURCE=.\t4.c
# End Source File
# Begin Source File
@@ -599,6 +603,10 @@
# End Source File
# Begin Source File
+SOURCE=.\spandsp/swept_tone.h
+# End Source File
+# Begin Source File
+
SOURCE=.\spandsp/t4.h
# End Source File
# Begin Source File
@@ -751,6 +759,10 @@
# End Source File
# Begin Source File
+SOURCE=.\spandsp/private/echo.h
+# End Source File
+# Begin Source File
+
SOURCE=.\spandsp/private/fax.h
# End Source File
# Begin Source File
@@ -799,6 +811,10 @@
# End Source File
# Begin Source File
+SOURCE=.\spandsp/private/modem_echo.h
+# End Source File
+# Begin Source File
+
SOURCE=.\spandsp/private/noise.h
# End Source File
# Begin Source File
@@ -831,6 +847,10 @@
# End Source File
# Begin Source File
+SOURCE=.\spandsp/private/swept_tone.h
+# End Source File
+# Begin Source File
+
SOURCE=.\spandsp/private/t30.h
# End Source File
# Begin Source File
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/make_at_dictionary.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/make_at_dictionary.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/make_at_dictionary.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.4 2009/04/24 22:35:25 steveu Exp $
+ * $Id: make_at_dictionary.c,v 1.5 2009/10/05 16:36:42 steveu Exp $
*/
#if defined(HAVE_CONFIG_H)
@@ -32,7 +32,6 @@
#include <inttypes.h>
#include <stdlib.h>
-#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/make_modem_filter.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/make_modem_filter.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/make_modem_filter.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.16 2009/07/10 13:15:56 steveu Exp $
+ * $Id: make_modem_filter.c,v 1.17 2009/10/03 04:37:25 steveu Exp $
*/
#if defined(HAVE_CONFIG_H)
@@ -44,7 +44,7 @@
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
-#if defined(__sunos) || defined(__solaris)
+#if defined(__sunos) || defined(__solaris) || defined(__sun)
#include <getopt.h>
#endif
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/modem_echo.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/modem_echo.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/modem_echo.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: modem_echo.c,v 1.25 2009/02/03 16:28:39 steveu Exp $
+ * $Id: modem_echo.c,v 1.26 2009/09/22 13:11:04 steveu Exp $
*/
/*! \file */
@@ -53,6 +53,8 @@
#include "spandsp/dc_restore.h"
#include "spandsp/modem_echo.h"
+#include "spandsp/private/modem_echo.h"
+
SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_create(int len)
{
modem_echo_can_state_t *ec;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/msvc/spandsp.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/msvc/spandsp.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/msvc/spandsp.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.18 2009/04/02 13:43:49 steveu Exp $
+ * $Id: spandsp.h.in,v 1.19 2009/09/22 13:11:04 steveu Exp $
*/
/*! \file */
@@ -69,6 +69,7 @@
#include <spandsp/complex_filters.h>
#include <spandsp/dc_restore.h>
#include <spandsp/dds.h>
+#include <spandsp/swept_tone.h>
#include <spandsp/echo.h>
#include <spandsp/modem_echo.h>
#include <spandsp/crc.h>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/sig_tone.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/sig_tone.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/sig_tone.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: sig_tone.c,v 1.32 2009/04/12 14:18:02 steveu Exp $
+ * $Id: sig_tone.c,v 1.33 2009/09/04 14:38:46 steveu Exp $
*/
/*! \file */
@@ -44,14 +44,17 @@
#include "floating_fudge.h"
#include <memory.h>
#include <string.h>
+#include <limits.h>
#undef SPANDSP_USE_FIXED_POINT
#include "spandsp/telephony.h"
#include "spandsp/fast_convert.h"
#include "spandsp/dc_restore.h"
#include "spandsp/saturated.h"
+#include "spandsp/vector_int.h"
#include "spandsp/complex.h"
#include "spandsp/dds.h"
+#include "spandsp/super_tone_rx.h"
#include "spandsp/sig_tone.h"
#include "spandsp/private/sig_tone.h"
@@ -67,12 +70,12 @@
{
/* 2280Hz (e.g. AC15, and many other European protocols) */
{2280, 0},
- {-10, -20}, /* -10+-1 dBmO and -20+-1 dBm0 */
- 400*(SAMPLE_RATE/1000), /* 300ms to 550ms */
+ {{-10, -20}, {0, 0}}, /* -10+-1 dBmO and -20+-1 dBm0 */
+ ms_to_samples(400), /* 300ms to 550ms */
- 225*(SAMPLE_RATE/1000),
+ ms_to_samples(225),
- 225*(SAMPLE_RATE/1000),
+ ms_to_samples(225),
TRUE,
24,
@@ -135,12 +138,12 @@
{
/* 2600Hz (e.g. many US protocols) */
{2600, 0},
- {-8, -8},
- 400*(SAMPLE_RATE/1000),
+ {{-8, -8}, {0, 0}},
+ ms_to_samples(400),
- 225*(SAMPLE_RATE/1000),
+ ms_to_samples(225),
- 225*(SAMPLE_RATE/1000),
+ ms_to_samples(225),
FALSE,
24,
@@ -202,13 +205,13 @@
},
{
/* 2400Hz/2600Hz (e.g. SS5 and SS5bis) */
- {2400, 2600},
- {-8, -8},
- 400*(SAMPLE_RATE/1000),
+ {2600, 2400},
+ {{-8, -8}, {-8, -8}},
+ ms_to_samples(400),
- 225*(SAMPLE_RATE/1000),
+ ms_to_samples(225),
- 225*(SAMPLE_RATE/1000),
+ ms_to_samples(225),
FALSE,
24,
@@ -276,19 +279,40 @@
int j;
int n;
int16_t tone;
- int update;
+ int need_update;
int high_low;
for (i = 0; i < len; i += n)
{
- if (s->current_tx_timeout < len - i)
- n = s->current_tx_timeout;
+ if (s->current_tx_timeout)
+ {
+ if (s->current_tx_timeout <= len - i)
+ {
+ n = s->current_tx_timeout;
+ need_update = TRUE;
+ }
+ else
+ {
+ n = len - i;
+ need_update = FALSE;
+ }
+ s->current_tx_timeout -= n;
+ }
else
+ {
n = len - i;
+ need_update = FALSE;
+ }
+ if (!(s->current_tx_tone & SIG_TONE_TX_PASSTHROUGH))
+ vec_zeroi16(&[i], n);
+ /*endif*/
if ((s->current_tx_tone & (SIG_TONE_1_PRESENT || SIG_TONE_2_PRESENT)))
{
/* Are we in the early phase (high tone energy level), or the sustaining
phase (low tone energy level) of tone generation? */
+ /* This doesn't try to get the high/low timing precise, as there is no
+ value in doing so. It works block by block, and the blocks are normally
+ quite short. */
if (s->high_low_timer > 0)
{
if (n > s->high_low_timer)
@@ -301,47 +325,30 @@
high_low = 1;
}
/*endif*/
- if (s->current_tx_tone & SIG_TONE_TX_PASSTHROUGH)
+ if ((s->current_tx_tone & SIG_TONE_1_PRESENT) && s->phase_rate[0])
{
for (j = i; j < i + n; j++)
{
- tone = dds_mod(&(s->phase_acc[0]), s->phase_rate[0], s->tone_scaling[high_low], 0);
+ tone = dds_mod(&(s->phase_acc[0]), s->phase_rate[0], s->tone_scaling[0][high_low], 0);
amp[j] = saturate(amp[j] + tone);
}
/*endfor*/
}
- else
+ /*endif*/
+ if ((s->current_tx_tone & SIG_TONE_2_PRESENT) && s->phase_rate[1])
{
for (j = i; j < i + n; j++)
- amp[j] = dds_mod(&(s->phase_acc[0]), s->phase_rate[0], s->tone_scaling[high_low], 0);
+ {
+ tone = dds_mod(&(s->phase_acc[1]), s->phase_rate[1], s->tone_scaling[1][high_low], 0);
+ amp[j] = saturate(amp[j] + tone);
+ }
/*endfor*/
}
/*endif*/
}
- else
- {
- /* There is no tone. We either leave the audio in the buffer, or silence it. */
- if (!(s->current_tx_tone & SIG_TONE_TX_PASSTHROUGH))
- {
- /* Zap any audio in the buffer */
- memset(amp + i, 0, sizeof(int16_t)*n);
- }
- /*endif*/
- }
/*endif*/
- if ((s->current_tx_timeout -= n) <= 0)
- {
- if (s->sig_update)
- {
- update = s->sig_update(s->user_data, SIG_TONE_UPDATE_REQUEST);
- if ((update & 0x03) == 0x03)
- s->high_low_timer = s->desc->high_low_timeout;
- /*endif*/
- s->current_tx_tone = update & 0xFFFF;
- s->current_tx_timeout = (update >> 16) & 0xFFFF;
- }
- /*endif*/
- }
+ if (need_update && s->sig_update)
+ s->sig_update(s->user_data, SIG_TONE_TX_UPDATE_REQUEST, 0, 0);
/*endif*/
}
/*endfor*/
@@ -349,17 +356,22 @@
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode)
+SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode, int duration)
{
- if ((mode & 0x03) == 0x03 && !(s->current_tx_tone & SIG_TONE_1_PRESENT))
+ int old_tones;
+ int new_tones;
+
+ old_tones = s->current_tx_tone & (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT);
+ new_tones = mode & (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT);
+ if (new_tones && old_tones != new_tones)
s->high_low_timer = s->desc->high_low_timeout;
/*endif*/
- s->current_tx_tone = mode & 0xFFFF;
- s->current_tx_timeout = (mode >> 16) & 0xFFFF;
+ s->current_tx_tone = mode;
+ s->current_tx_timeout = duration;
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data)
+SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data)
{
int i;
@@ -385,7 +397,8 @@
s->phase_rate[i] = dds_phase_rate((float) s->desc->tone_freq[i]);
else
s->phase_rate[i] = 0;
- s->tone_scaling[i] = dds_scaling_dbm0((float) s->desc->tone_amp[i]);
+ s->tone_scaling[i][0] = dds_scaling_dbm0((float) s->desc->tone_amp[i][0]);
+ s->tone_scaling[i][1] = dds_scaling_dbm0((float) s->desc->tone_amp[i][1]);
}
return s;
}
@@ -404,6 +417,7 @@
return 0;
}
/*- End of function --------------------------------------------------------*/
+
SPAN_DECLARE(int) sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len)
{
#if defined(SPANDSP_USE_FIXED_POINT)
@@ -422,7 +436,7 @@
for (i = 0; i < len; i++)
{
- if (s->signaling_state_duration < 0xFFFF)
+ if (s->signaling_state_duration < INT_MAX)
s->signaling_state_duration++;
/*endif*/
notched_signal = 0;
@@ -529,7 +543,7 @@
if (!s->tone_present)
{
if (s->sig_update)
- s->sig_update(s->user_data, SIG_TONE_1_CHANGE | (s->signaling_state_duration << 16));
+ s->sig_update(s->user_data, SIG_TONE_1_CHANGE, 0, s->signaling_state_duration);
/*endif*/
s->signaling_state_duration = 0;
}
@@ -541,15 +555,15 @@
if (s->tone_present)
{
if (s->sig_update)
- s->sig_update(s->user_data, SIG_TONE_1_CHANGE | SIG_TONE_1_PRESENT | (s->signaling_state_duration << 16));
+ s->sig_update(s->user_data, SIG_TONE_1_CHANGE | SIG_TONE_1_PRESENT, 0, s->signaling_state_duration);
/*endif*/
s->signaling_state_duration = 0;
}
/*endif*/
}
/*endif*/
- /* Notch insertion logic */
-
+
+ /* Notch insertion logic */
/* tone_present and tone_on are equivalent in flat mode */
if (s->tone_present)
{
@@ -590,7 +604,7 @@
s->tone_persistence_timeout = s->desc->tone_off_check_time;
s->notch_insertion_timeout = s->desc->notch_lag_time;
if (s->sig_update)
- s->sig_update(s->user_data, SIG_TONE_1_CHANGE | SIG_TONE_1_PRESENT | (s->signaling_state_duration << 16));
+ s->sig_update(s->user_data, SIG_TONE_1_CHANGE | SIG_TONE_1_PRESENT, 0, s->signaling_state_duration);
/*endif*/
s->signaling_state_duration = 0;
}
@@ -626,7 +640,7 @@
s->tone_present = FALSE;
s->tone_persistence_timeout = s->desc->tone_on_check_time;
if (s->sig_update)
- s->sig_update(s->user_data, SIG_TONE_1_CHANGE | (s->signaling_state_duration << 16));
+ s->sig_update(s->user_data, SIG_TONE_1_CHANGE, 0, s->signaling_state_duration);
/*endif*/
s->signaling_state_duration = 0;
}
@@ -648,7 +662,7 @@
if ((s->current_rx_tone & SIG_TONE_RX_PASSTHROUGH))
{
- if (s->notch_enabled)
+ if ((s->current_rx_tone & SIG_TONE_RX_FILTER_TONE) || s->notch_enabled)
amp[i] = (int16_t) notched_signal;
/*endif*/
}
@@ -663,8 +677,14 @@
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data)
+SPAN_DECLARE(void) sig_tone_rx_set_mode(sig_tone_rx_state_t *s, int mode, int duration)
{
+ s->current_rx_tone = mode;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data)
+{
if (sig_update == NULL || tone_type < 1 || tone_type > 3)
return NULL;
/*endif*/
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/silence_gen.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/silence_gen.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/silence_gen.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: silence_gen.c,v 1.22 2009/06/02 16:03:56 steveu Exp $
+ * $Id: silence_gen.c,v 1.23 2009/09/04 14:38:46 steveu Exp $
*/
/*! \file */
@@ -158,4 +158,10 @@
return len;
}
/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE_NONSTD(int) span_dummy_rx_fillin(void *user_data, int len)
+{
+ return 0;
+}
+/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/echo.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/echo.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/echo.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: echo.h,v 1.19 2009/02/10 13:06:47 steveu Exp $
+ * $Id: echo.h,v 1.20 2009/09/22 13:11:04 steveu Exp $
*/
/*! \file */
@@ -133,60 +133,8 @@
G.168 echo canceller descriptor. This defines the working state for a line
echo canceller.
*/
-typedef struct
-{
- int tx_power[4];
- int rx_power[3];
- int clean_rx_power;
+typedef struct echo_can_state_s echo_can_state_t;
- int rx_power_threshold;
- int nonupdate_dwell;
-
- int curr_pos;
-
- int taps;
- int tap_mask;
- int adaption_mode;
-
- int32_t supp_test1;
- int32_t supp_test2;
- int32_t supp1;
- int32_t supp2;
- int vad;
- int cng;
-
- int16_t geigel_max;
- int geigel_lag;
- int dtd_onset;
- int tap_set;
- int tap_rotate_counter;
-
- int32_t latest_correction; /* Indication of the magnitude of the latest
- adaption, or a code to indicate why adaption
- was skipped, for test purposes */
- int32_t last_acf[28];
- int narrowband_count;
- int narrowband_score;
-
- fir16_state_t fir_state;
- /*! Echo FIR taps (16 bit version) */
- int16_t *fir_taps16[4];
- /*! Echo FIR taps (32 bit version) */
- int32_t *fir_taps32;
-
- /* DC and near DC blocking filter states */
- int32_t tx_hpf[2];
- int32_t rx_hpf[2];
-
- /* Parameters for the optional Hoth noise generator */
- int cng_level;
- int cng_rndnum;
- int cng_filter;
-
- /* Snapshot sample of coeffs used for development */
- int16_t *snapshot;
-} echo_can_state_t;
-
#if defined(__cplusplus)
extern "C"
{
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/expose.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/expose.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/expose.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.13 2009/05/16 03:34:45 steveu Exp $
+ * $Id: expose.h,v 1.14 2009/09/22 13:11:04 steveu Exp $
*/
/*! \file */
@@ -56,6 +56,9 @@
#include <spandsp/private/super_tone_tx.h>
#include <spandsp/private/super_tone_rx.h>
#include <spandsp/private/silence_gen.h>
+#include <spandsp/private/swept_tone.h>
+#include <spandsp/private/echo.h>
+#include <spandsp/private/modem_echo.h>
#include <spandsp/private/async.h>
#include <spandsp/private/fsk.h>
#include <spandsp/private/v29rx.h>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/fast_convert.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/fast_convert.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/fast_convert.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: fast_convert.h,v 1.8 2009/07/10 13:15:56 steveu Exp $
+ * $Id: fast_convert.h,v 1.9 2009/10/03 04:37:25 steveu Exp $
*/
#if !defined(_SPANDSP_FAST_CONVERT_H_)
@@ -150,7 +150,7 @@
);
return retval;
}
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) || (__SUNPRO_C >= 0x0590)
#if defined(__i386__)
/* These routines are guaranteed fast on an i386 machine. Using the built in
@@ -403,7 +403,7 @@
the accuracy issues related to changing the rounding scheme are of little concern
to us. */
- #if !defined(__sgi) && !defined(__sunos) && !defined(__solaris)
+ #if !defined(__sgi) && !defined(__sunos) && !defined(__solaris) && !defined(__sun)
#warning "No usable lrint() and lrintf() functions available."
#warning "Replacing these functions with a simple C cast."
#endif
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/modem_echo.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/modem_echo.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/modem_echo.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: modem_echo.h,v 1.13 2009/02/03 16:28:41 steveu Exp $
+ * $Id: modem_echo.h,v 1.14 2009/09/22 13:11:04 steveu Exp $
*/
/*! \file */
@@ -84,23 +84,8 @@
Modem line echo canceller descriptor. This defines the working state for a line
echo canceller.
*/
-typedef struct
-{
- int adapt;
- int taps;
+typedef struct modem_echo_can_state_s modem_echo_can_state_t;
- fir16_state_t fir_state;
- /*! Echo FIR taps (16 bit version) */
- int16_t *fir_taps16;
- /*! Echo FIR taps (32 bit version) */
- int32_t *fir_taps32;
-
- int tx_power;
- int rx_power;
-
- int curr_pos;
-} modem_echo_can_state_t;
-
#if defined(__cplusplus)
extern "C"
{
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/echo.h (from rev 15313, freeswitch/trunk/libs/spandsp/src/spandsp/private/echo.h) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/echo.h (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/echo.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,94 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/echo.h - An echo cancellor, suitable for electrical and acoustic
+ * cancellation. This code does not currently comply with
+ * any relevant standards (e.g. G.164/5/7/8).
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2001 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: echo.h,v 1.1 2009/09/22 13:11:04 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_ECHO_H_)
+#define _SPANDSP_PRIVATE_ECHO_H_
+
+/*!
+ G.168 echo canceller descriptor. This defines the working state for a line
+ echo canceller.
+*/
+struct echo_can_state_s
+{
+ int tx_power[4];
+ int rx_power[3];
+ int clean_rx_power;
+
+ int rx_power_threshold;
+ int nonupdate_dwell;
+
+ int curr_pos;
+
+ int taps;
+ int tap_mask;
+ int adaption_mode;
+
+ int32_t supp_test1;
+ int32_t supp_test2;
+ int32_t supp1;
+ int32_t supp2;
+ int vad;
+ int cng;
+
+ int16_t geigel_max;
+ int geigel_lag;
+ int dtd_onset;
+ int tap_set;
+ int tap_rotate_counter;
+
+ int32_t latest_correction; /* Indication of the magnitude of the latest
+ adaption, or a code to indicate why adaption
+ was skipped, for test purposes */
+ int32_t last_acf[28];
+ int narrowband_count;
+ int narrowband_score;
+
+ fir16_state_t fir_state;
+ /*! Echo FIR taps (16 bit version) */
+ int16_t *fir_taps16[4];
+ /*! Echo FIR taps (32 bit version) */
+ int32_t *fir_taps32;
+
+ /* DC and near DC blocking filter states */
+ int32_t tx_hpf[2];
+ int32_t rx_hpf[2];
+
+ /* Parameters for the optional Hoth noise generator */
+ int cng_level;
+ int cng_rndnum;
+ int cng_filter;
+
+ /* Snapshot sample of coeffs used for development */
+ int16_t *snapshot;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/fax_modems.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/fax_modems.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/fax_modems.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.h,v 1.3 2009/03/23 14:17:42 steveu Exp $
+ * $Id: fax_modems.h,v 1.4 2009/09/04 14:38:47 steveu Exp $
*/
/*! \file */
@@ -95,11 +95,9 @@
/*! The current receive signal handler */
span_rx_handler_t *rx_handler;
- void *rx_user_data;
-
/*! The current receive missing signal fill-in handler */
span_rx_fillin_handler_t *rx_fillin_handler;
- void *rx_fillin_user_data;
+ void *rx_user_data;
/*! The current transmit signal handler */
span_tx_handler_t *tx_handler;
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/modem_echo.h (from rev 15313, freeswitch/trunk/libs/spandsp/src/spandsp/private/modem_echo.h) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/modem_echo.h (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/modem_echo.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,58 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/modem_echo.h - An echo cancellor, suitable for electrical echos in GSTN modems
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2001, 2004 Steve Underwood
+ *
+ * Based on a bit from here, a bit from there, eye of toad,
+ * ear of bat, etc - plus, of course, my own 2 cents.
+ *
+ * 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: modem_echo.h,v 1.1 2009/09/22 13:11:04 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_MODEM_ECHO_H_)
+#define _SPANDSP_PRIVATE_MODEM_ECHO_H_
+
+/*!
+ Modem line echo canceller descriptor. This defines the working state for a line
+ echo canceller.
+*/
+struct modem_echo_can_state_s
+{
+ int adapt;
+ int taps;
+
+ fir16_state_t fir_state;
+ /*! Echo FIR taps (16 bit version) */
+ int16_t *fir_taps16;
+ /*! Echo FIR taps (32 bit version) */
+ int32_t *fir_taps32;
+
+ int tx_power;
+ int rx_power;
+
+ int curr_pos;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/sig_tone.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/sig_tone.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/sig_tone.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: sig_tone.h,v 1.3 2009/04/12 14:18:02 steveu Exp $
+ * $Id: sig_tone.h,v 1.4 2009/09/04 14:38:47 steveu Exp $
*/
#if !defined(_SPANDSP_PRIVATE_SIG_TONE_H_)
@@ -38,8 +38,8 @@
{
/*! \brief The tones used. */
int tone_freq[2];
- /*! \brief The high and low tone amplitudes. */
- int tone_amp[2];
+ /*! \brief The high and low tone amplitudes for each of the tones. */
+ int tone_amp[2][2];
/*! \brief The delay, in audio samples, before the high level tone drops
to a low level tone. */
@@ -80,7 +80,6 @@
#endif
} tone[2];
-
#if defined(SPANDSP_USE_FIXED_POINT)
/*! \brief Flat mode bandpass bi-quad parameters */
int32_t broad_a[3];
@@ -128,23 +127,23 @@
struct sig_tone_tx_state_s
{
/*! \brief The callback function used to handle signaling changes. */
- sig_tone_func_t sig_update;
+ tone_report_func_t sig_update;
/*! \brief A user specified opaque pointer passed to the callback function. */
void *user_data;
/*! \brief Tone descriptor */
sig_tone_descriptor_t *desc;
- /*! The scaling values for the high and low level tones */
- int16_t tone_scaling[2];
- /*! The sample timer, used to switch between the high and low level tones. */
- int high_low_timer;
-
/*! The phase rates for the one or two tones */
int32_t phase_rate[2];
/*! The phase accumulators for the one or two tones */
uint32_t phase_acc[2];
+ /*! The scaling values for the one or two tones, and the high and low level of each tone */
+ int16_t tone_scaling[2][2];
+ /*! The sample timer, used to switch between the high and low level tones. */
+ int high_low_timer;
+
/*! \brief Current transmit tone */
int current_tx_tone;
/*! \brief Current transmit timeout */
@@ -159,7 +158,7 @@
struct sig_tone_rx_state_s
{
/*! \brief The callback function used to handle signaling changes. */
- sig_tone_func_t sig_update;
+ tone_report_func_t sig_update;
/*! \brief A user specified opaque pointer passed to the callback function. */
void *user_data;
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/swept_tone.h (from rev 15313, freeswitch/trunk/libs/spandsp/src/spandsp/private/swept_tone.h) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/swept_tone.h (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/swept_tone.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,44 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/swept_tone.h - Swept tone generation
+ *
+ * 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 General Public License version 2, 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: swept_tone.h,v 1.1 2009/09/22 12:54:33 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_SWEPT_TONE_H_)
+#define _SPANDSP_PRIVATE_SWEPT_TONE_H_
+
+struct swept_tone_state_s
+{
+ int32_t starting_phase_inc;
+ int32_t phase_inc_step;
+ int scale;
+ int duration;
+ int repeating;
+ int pos;
+ int32_t current_phase_inc;
+ uint32_t phase;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/t30.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/t30.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/private/t30.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.4 2009/04/12 14:18:02 steveu Exp $
+ * $Id: t30.h,v 1.5 2009/09/20 13:42:29 steveu Exp $
*/
/*! \file */
@@ -221,10 +221,10 @@
/*! \brief A bit map of the OK ECM frames, constructed as a PPR frame. */
uint8_t ecm_frame_map[3 + 32];
- /*! \brief The current page number for receiving, in ECM mode. This is reset at the start of a call. */
- int ecm_rx_page;
- /*! \brief The current page number for sending, in ECM mode. This is reset at the start of a call. */
- int ecm_tx_page;
+ /*! \brief The current page number for receiving, in ECM or non-ECM mode. This is reset at the start of a call. */
+ int rx_page_number;
+ /*! \brief The current page number for sending, in ECM or non-ECM mode. This is reset at the start of a call. */
+ int tx_page_number;
/*! \brief The current block number, in ECM mode */
int ecm_block;
/*! \brief The number of frames in the current block number, in ECM mode */
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/sig_tone.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/sig_tone.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/sig_tone.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: sig_tone.h,v 1.19 2009/04/12 14:18:02 steveu Exp $
+ * $Id: sig_tone.h,v 1.20 2009/09/04 14:38:46 steveu Exp $
*/
/*! \file */
@@ -54,32 +54,39 @@
#if !defined(_SPANDSP_SIG_TONE_H_)
#define _SPANDSP_SIG_TONE_H_
-typedef int (*sig_tone_func_t)(void *user_data, int what);
-
/* The optional tone sets */
enum
{
- /*! European 2280Hz signaling tone */
+ /*! European 2280Hz signaling tone. Tone 1 is 2280Hz. Tone 2 is not used. */
SIG_TONE_2280HZ = 1,
- /*! US 2600Hz signaling tone */
+ /*! US 2600Hz signaling tone. Tone 1 is 2600Hz. Tone 2 is not used. */
SIG_TONE_2600HZ,
- /*! US 2400Hz + 2600Hz signaling tones */
+ /*! US 2400Hz + 2600Hz signaling tones. Tone 1 is 2600Hz. Tone 2 is 2400Hz. */
SIG_TONE_2400HZ_2600HZ
};
+/* Mode control and report bits for transmit and receive */
enum
{
/*! Signaling tone 1 is present */
SIG_TONE_1_PRESENT = 0x001,
+ /*! Signaling tone 1 has changed state (ignored when setting tx mode) */
SIG_TONE_1_CHANGE = 0x002,
/*! Signaling tone 2 is present */
SIG_TONE_2_PRESENT = 0x004,
+ /*! Signaling tone 2 has changed state (ignored when setting tx mode) */
SIG_TONE_2_CHANGE = 0x008,
/*! The media signal is passing through. Tones might be added to it. */
SIG_TONE_TX_PASSTHROUGH = 0x010,
/*! The media signal is passing through. Tones might be extracted from it, if detected. */
- SIG_TONE_RX_PASSTHROUGH = 0x020,
- SIG_TONE_UPDATE_REQUEST = 0x100
+ SIG_TONE_RX_PASSTHROUGH = 0x040,
+ /*! Force filtering of the signaling tone, whether signaling is being detected or not.
+ This is mostly useful for test purposes. */
+ SIG_TONE_RX_FILTER_TONE = 0x080,
+ /*! Request an update of the transmit status, upon timeout of the previous status. */
+ SIG_TONE_TX_UPDATE_REQUEST = 0x100,
+ /*! Request an update of the receiver status, upon timeout of the previous status. */
+ SIG_TONE_RX_UPDATE_REQUEST = 0x200
};
/*!
@@ -106,6 +113,14 @@
\return The number of samples unprocessed. */
SPAN_DECLARE(int) sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len);
+/*! Set the receive mode.
+ \brief Set the receive mode.
+ \param s The signaling tone context.
+ \param mode The new mode for the receiver.
+ \param duration The duration for this mode, before an update is requested.
+ A duration of zero means forever. */
+SPAN_DECLARE(void) sig_tone_rx_set_mode(sig_tone_rx_state_t *s, int mode, int duration);
+
/*! Initialise a signaling tone receiver context.
\brief Initialise a signaling tone context.
\param s The signaling tone context.
@@ -113,7 +128,7 @@
\param sig_update Callback function to handle signaling updates.
\param user_data An opaque pointer.
\return A pointer to the signalling tone context, or NULL if there was a problem. */
-SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data);
+SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data);
/*! Release a signaling tone receiver context.
\brief Release a signaling tone receiver context.
@@ -138,8 +153,10 @@
/*! Set the tone mode.
\brief Set the tone mode.
\param s The signaling tone context.
- \param mode The new mode for the transmitted tones. */
-SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode);
+ \param mode The new mode for the transmitted tones.
+ \param duration The duration for this mode, before an update is requested.
+ A duration of zero means forever. */
+SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode, int duration);
/*! Initialise a signaling tone transmitter context.
\brief Initialise a signaling tone context.
@@ -148,7 +165,7 @@
\param sig_update Callback function to handle signaling updates.
\param user_data An opaque pointer.
\return A pointer to the signalling tone context, or NULL if there was a problem. */
-SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data);
+SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data);
/*! Release a signaling tone transmitter context.
\brief Release a signaling tone transmitter context.
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/silence_gen.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/silence_gen.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/silence_gen.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: silence_gen.h,v 1.18 2009/06/02 16:03:56 steveu Exp $
+ * $Id: silence_gen.h,v 1.19 2009/09/04 14:38:47 steveu Exp $
*/
#if !defined(_SPANDSP_SILENCE_GEN_H_)
@@ -125,6 +125,16 @@
*/
SPAN_DECLARE(int) span_dummy_mod(void *user_data, int16_t amp[], int len);
+/*! A dummy routine to use as a receive fillin callback, when we aren't really
+ trying to process what is received. It just absorbs and ignores the
+ request.
+ \brief Dummy receive fillin callback.
+ \param user_data The context.
+ \param len The length of the signal buffer
+ \return 0.
+*/
+SPAN_DECLARE_NONSTD(int) span_dummy_rx_fillin(void *user_data, int len);
+
#if defined(__cplusplus)
}
#endif
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/swept_tone.h (from rev 15313, freeswitch/trunk/libs/spandsp/src/spandsp/swept_tone.h) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/swept_tone.h (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/swept_tone.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,59 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * swept_tone.h - Swept tone generation
+ *
+ * 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 General Public License version 2, 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: swept_tone.h,v 1.1 2009/09/22 12:54:33 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_SWEPT_TONE_H_)
+#define _SPANDSP_SWEPT_TONE_H_
+
+/*! \page swept_tone_page The swept tone generator
+\section swept_tone_page_sec_1 What does it do?
+*/
+
+typedef struct swept_tone_state_s swept_tone_state_t;
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+SPAN_DECLARE(swept_tone_state_t *) swept_tone_init(swept_tone_state_t *s, float start, float end, float level, int duration, int repeating);
+
+SPAN_DECLARE(int) swept_tone(swept_tone_state_t *s, int16_t amp[], int len);
+
+SPAN_DECLARE(float) swept_tone_current_frequency(swept_tone_state_t *s);
+
+SPAN_DECLARE(int) swept_tone_release(swept_tone_state_t *s);
+
+SPAN_DECLARE(int) swept_tone_free(swept_tone_state_t *s);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+/*- End of file ------------------------------------------------------------*/
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/t30.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/t30.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/t30.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.125 2009/04/12 09:12:10 steveu Exp $
+ * $Id: t30.h,v 1.126 2009/09/21 15:52:39 steveu Exp $
*/
/*! \file */
@@ -524,9 +524,9 @@
int pages_rx;
/*! \brief The number of pages in the file (<0 if not known). */
int pages_in_file;
- /*! \brief The horizontal column-to-column resolution of the page, in pixels per metre */
+ /*! \brief The horizontal column-to-column resolution of the most recent page, in pixels per metre */
int x_resolution;
- /*! \brief The vertical row-to-row resolution of the page, in pixels per metre */
+ /*! \brief The vertical row-to-row resolution of the most recent page, in pixels per metre */
int y_resolution;
/*! \brief The number of horizontal pixels in the most recent page. */
int width;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/timing.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/timing.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/timing.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: timing.h,v 1.13 2008/04/17 14:27:01 steveu Exp $
+ * $Id: timing.h,v 1.14 2009/09/04 14:38:47 steveu Exp $
*/
#if !defined(_SPANDSP_TIMING_H_)
@@ -56,8 +56,8 @@
#elif defined(__x86_64__)
static __inline__ uint64_t rdtscll(void)
{
- unsigned int a;
- unsigned int d;
+ uint32_t a;
+ uint32_t d;
/* For x86_64 we need to merge the result in 2 32 bit registers
into one clean 64 bit result. */
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/version.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/version.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp/version.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -30,9 +30,9 @@
/* The date and time of the version are in UTC form. */
-#define SPANDSP_RELEASE_DATE 20090714
-#define SPANDSP_RELEASE_TIME 135534
-#define SPANDSP_RELEASE_DATETIME_STRING "20090714 135534"
+#define SPANDSP_RELEASE_DATE 20091005
+#define SPANDSP_RELEASE_TIME 163835
+#define SPANDSP_RELEASE_DATETIME_STRING "20091005 163835"
#endif
/*- End of file ------------------------------------------------------------*/
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp.h.in (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp.h.in 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/spandsp.h.in 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.18 2009/04/02 13:43:49 steveu Exp $
+ * $Id: spandsp.h.in,v 1.19 2009/09/22 13:11:04 steveu Exp $
*/
/*! \file */
@@ -66,6 +66,7 @@
#include <spandsp/complex_filters.h>
#include <spandsp/dc_restore.h>
#include <spandsp/dds.h>
+#include <spandsp/swept_tone.h>
#include <spandsp/echo.h>
#include <spandsp/modem_echo.h>
#include <spandsp/crc.h>
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/swept_tone.c (from rev 15313, freeswitch/trunk/libs/spandsp/src/swept_tone.c) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/swept_tone.c (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/swept_tone.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,128 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * swept_tone.c - Swept tone generation
+ *
+ * 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 General Public License version 2, 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: swept_tone.c,v 1.2 2009/09/23 16:02:59 steveu Exp $
+ */
+
+/*! \file */
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <inttypes.h>
+#include <string.h>
+#include <stdio.h>
+#if defined(HAVE_TGMATH_H)
+#include <tgmath.h>
+#endif
+#if defined(HAVE_MATH_H)
+#include <math.h>
+#endif
+#include "floating_fudge.h"
+
+#include "spandsp/telephony.h"
+#include "spandsp/logging.h"
+#include "spandsp/complex.h"
+#include "spandsp/vector_float.h"
+#include "spandsp/complex_vector_float.h"
+#include "spandsp/vector_int.h"
+#include "spandsp/complex_vector_int.h"
+#include "spandsp/dds.h"
+
+#include "spandsp/swept_tone.h"
+
+#include "spandsp/private/logging.h"
+#include "spandsp/private/swept_tone.h"
+
+SPAN_DECLARE(swept_tone_state_t *) swept_tone_init(swept_tone_state_t *s, float start, float end, float level, int duration, int repeating)
+{
+ if (s == NULL)
+ {
+ if ((s = (swept_tone_state_t *) malloc(sizeof(*s))) == NULL)
+ return NULL;
+ }
+ memset(s, 0, sizeof(*s));
+ s->current_phase_inc =
+ s->starting_phase_inc = dds_phase_rate(start);
+ s->phase_inc_step = dds_phase_rate((end - start)/(float) duration);
+ s->scale = dds_scaling_dbm0(level);
+ s->duration = duration;
+ s->repeating = repeating;
+ s->pos = 0;
+ s->phase = 0;
+ return s;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) swept_tone(swept_tone_state_t *s, int16_t amp[], int max_len)
+{
+ int i;
+ int len;
+ int chunk_len;
+
+ for (len = 0; len < max_len; )
+ {
+ chunk_len = max_len - len;
+ if (chunk_len > s->duration - s->pos)
+ chunk_len = s->duration - s->pos;
+ for (i = len; i < len + chunk_len; i++)
+ {
+ amp[i] = (dds(&s->phase, s->current_phase_inc)*s->scale) >> 15;
+ s->current_phase_inc += s->phase_inc_step;
+ }
+ len += chunk_len;
+ s->pos += chunk_len;
+ if (s->pos >= s->duration)
+ {
+ if (!s->repeating)
+ break;
+ s->pos = 0;
+ s->current_phase_inc = s->starting_phase_inc;
+ }
+ }
+ return len;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(float) swept_tone_current_frequency(swept_tone_state_t *s)
+{
+ return dds_frequency(s->current_phase_inc);
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) swept_tone_release(swept_tone_state_t *s)
+{
+ return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) swept_tone_free(swept_tone_state_t *s)
+{
+ free(s);
+ return 0;
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/t30.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/t30.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/t30.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.301 2009/05/25 12:37:38 steveu Exp $
+ * $Id: t30.c,v 1.303 2009/09/21 15:51:18 steveu Exp $
*/
/*! \file */
@@ -421,7 +421,7 @@
}
s->ecm_block = 0;
s->error_correcting_mode_retries = 0;
- span_log(&s->logging, SPAN_LOG_FLOW, "Starting page %d of transfer\n", s->ecm_tx_page + 1);
+ span_log(&s->logging, SPAN_LOG_FLOW, "Starting page %d of transfer\n", s->tx_page_number + 1);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -431,7 +431,7 @@
s->retries = 0;
if (t4_tx_end_page(&(s->t4)) == 0)
{
- s->ecm_tx_page++;
+ s->tx_page_number++;
s->ecm_block = 0;
}
return 0;
@@ -470,7 +470,7 @@
{
if (t4_rx_end_page(&(s->t4)) == 0)
{
- s->ecm_rx_page++;
+ s->rx_page_number++;
s->ecm_block = 0;
}
return 0;
@@ -1042,7 +1042,7 @@
frame[1] = CONTROL_FIELD_FINAL_FRAME;
frame[2] = (uint8_t) (T30_PPS | s->dis_received);
frame[3] = (s->ecm_at_page_end) ? ((uint8_t) (s->next_tx_step | s->dis_received)) : T30_NULL;
- frame[4] = (uint8_t) (s->ecm_tx_page & 0xFF);
+ frame[4] = (uint8_t) (s->tx_page_number & 0xFF);
frame[5] = (uint8_t) (s->ecm_block & 0xFF);
frame[6] = (uint8_t) ((s->ecm_frames_this_tx_burst == 0) ? 0 : (s->ecm_frames_this_tx_burst - 1));
span_log(&s->logging, SPAN_LOG_FLOW, "Sending PPS + %s\n", t30_frametype(frame[3]));
@@ -1957,30 +1957,19 @@
}
/*- End of function --------------------------------------------------------*/
-static void unexpected_frame(t30_state_t *s, const uint8_t *msg, int len)
-{
- span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected %s received in state %d\n", t30_frametype(msg[2]), s->state);
- switch (s->state)
- {
- case T30_STATE_F_DOC_ECM:
- case T30_STATE_F_DOC_NON_ECM:
- s->current_status = T30_ERR_RX_INVALCMD;
- break;
- }
-}
-/*- End of function --------------------------------------------------------*/
-
static void unexpected_non_final_frame(t30_state_t *s, const uint8_t *msg, int len)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected %s frame in state %d\n", t30_frametype(msg[2]), s->state);
- s->current_status = T30_ERR_UNEXPECTED;
+ if (s->current_status == T30_ERR_OK)
+ s->current_status = T30_ERR_UNEXPECTED;
}
/*- End of function --------------------------------------------------------*/
static void unexpected_final_frame(t30_state_t *s, const uint8_t *msg, int len)
{
- span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected %s received in state %d\n", t30_frametype(msg[2]), s->state);
- s->current_status = T30_ERR_UNEXPECTED;
+ span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected %s frame in state %d\n", t30_frametype(msg[2]), s->state);
+ if (s->current_status == T30_ERR_OK)
+ s->current_status = T30_ERR_UNEXPECTED;
send_dcn(s);
}
/*- End of function --------------------------------------------------------*/
@@ -1988,7 +1977,8 @@
static void unexpected_frame_length(t30_state_t *s, const uint8_t *msg, int len)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected %s frame length - %d\n", t30_frametype(msg[0]), len);
- s->current_status = T30_ERR_UNEXPECTED;
+ if (s->current_status == T30_ERR_OK)
+ s->current_status = T30_ERR_UNEXPECTED;
send_dcn(s);
}
/*- End of function --------------------------------------------------------*/
@@ -2372,9 +2362,9 @@
}
}
span_log(&s->logging, SPAN_LOG_FLOW, "Received PPS + %s - page %d, block %d, %d frames\n", t30_frametype(msg[3]), page, block, frames);
- if (page != s->ecm_rx_page)
+ if (page != s->rx_page_number)
{
- span_log(&s->logging, SPAN_LOG_FLOW, "ECM rx page mismatch - expected %d, but received %d.\n", s->ecm_rx_page, page);
+ span_log(&s->logging, SPAN_LOG_FLOW, "ECM rx page mismatch - expected %d, but received %d.\n", s->rx_page_number, page);
}
if (block != s->ecm_block)
{
@@ -2645,7 +2635,11 @@
static void process_state_answering(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ /* We should be sending the TCF data right now */
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_DIS:
/* TODO: This is a fudge to allow for starting up in T.38, where the other end has
@@ -2675,7 +2669,11 @@
static void process_state_b(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ /* We should be sending the TCF data right now */
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_DCN:
/* Just ignore any DCN's which appear at this stage. */
@@ -2696,7 +2694,10 @@
static void process_state_c(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_DCN:
/* Just ignore any DCN's which appear at this stage. */
@@ -2717,8 +2718,11 @@
static void process_state_d(t30_state_t *s, const uint8_t *msg, int len)
{
+ uint8_t fcf;
+
/* We should be sending the DCS sequence right now */
- switch (msg[2] & 0xFE)
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_DCN:
s->current_status = T30_ERR_TX_BADDCS;
@@ -2740,8 +2744,11 @@
static void process_state_d_tcf(t30_state_t *s, const uint8_t *msg, int len)
{
+ uint8_t fcf;
+
/* We should be sending the TCF data right now */
- switch (msg[2] & 0xFE)
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_DCN:
s->current_status = T30_ERR_TX_BADDCS;
@@ -2763,7 +2770,10 @@
static void process_state_d_post_tcf(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_CFR:
/* Trainability test succeeded. Send the document. */
@@ -2832,8 +2842,11 @@
static void process_state_f_tcf(t30_state_t *s, const uint8_t *msg, int len)
{
+ uint8_t fcf;
+
/* We should be receiving TCF right now, not HDLC messages */
- switch (msg[2] & 0xFE)
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_CRP:
repeat_last_command(s);
@@ -2851,8 +2864,11 @@
static void process_state_f_cfr(t30_state_t *s, const uint8_t *msg, int len)
{
+ uint8_t fcf;
+
/* We're waiting for a response to the CFR we sent */
- switch (msg[2] & 0xFE)
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_DCS:
/* If we received another DCS, they must have missed our CFR */
@@ -2874,8 +2890,11 @@
static void process_state_f_ftt(t30_state_t *s, const uint8_t *msg, int len)
{
+ uint8_t fcf;
+
/* We're waiting for a response to the FTT we sent */
- switch (msg[2] & 0xFE)
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_DCS:
process_rx_dcs(s, msg, len);
@@ -2896,12 +2915,15 @@
static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int len)
{
+ uint8_t fcf;
+
/* If we are getting HDLC messages, and we have not moved to the _POST_DOC_NON_ECM
state, it looks like either:
- we didn't see the image data carrier properly, or
- they didn't see our T30_CFR, and are repeating the DCS/TCF sequence.
- they didn't see out T30_MCF, and are repeating the end of page message. */
- switch (msg[2] & 0xFE)
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_DIS:
process_rx_dis_dtc(s, msg, len);
@@ -2912,7 +2934,7 @@
case T30_MPS:
/* Treat this as a bad quality page. */
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, msg[2] & 0xFE);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->next_rx_step = msg[2] & 0xFE;
queue_phase(s, T30_PHASE_D_TX);
set_state(s, T30_STATE_III_Q_RTN);
@@ -2922,7 +2944,7 @@
/* Treat this as a bad quality page. */
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, msg[2] & 0xFE);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
s->next_rx_step = msg[2] & 0xFE;
@@ -2932,7 +2954,7 @@
case T30_EOS:
/* Treat this as a bad quality page. */
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, msg[2] & 0xFE);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->next_rx_step = msg[2] & 0xFE;
/* Return to phase B */
queue_phase(s, T30_PHASE_B_TX);
@@ -2943,7 +2965,7 @@
/* Treat this as a bad quality page. */
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, msg[2] & 0xFE);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
s->next_rx_step = T30_PRI_EOM;
@@ -2952,7 +2974,7 @@
case T30_EOP:
/* Treat this as a bad quality page. */
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, msg[2] & 0xFE);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->next_rx_step = msg[2] & 0xFE;
queue_phase(s, T30_PHASE_D_TX);
set_state(s, T30_STATE_III_Q_RTN);
@@ -2962,7 +2984,7 @@
/* Treat this as a bad quality page. */
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, msg[2] & 0xFE);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
s->next_rx_step = msg[2] & 0xFE;
@@ -2980,6 +3002,7 @@
break;
default:
/* We don't know what to do with this. */
+ s->current_status = T30_ERR_RX_INVALCMD;
unexpected_final_frame(s, msg, len);
break;
}
@@ -2988,12 +3011,15 @@
static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_MPS:
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, msg[2] & 0xFE);
- s->next_rx_step = msg[2] & 0xFE;
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
+ s->next_rx_step = fcf;
queue_phase(s, T30_PHASE_D_TX);
switch (copy_quality(s))
{
@@ -3020,10 +3046,10 @@
case T30_PRI_MPS:
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, msg[2] & 0xFE);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
- s->next_rx_step = msg[2] & 0xFE;
+ s->next_rx_step = fcf;
switch (copy_quality(s))
{
case T30_COPY_QUALITY_PERFECT:
@@ -3049,8 +3075,8 @@
case T30_EOM:
case T30_EOS:
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, msg[2] & 0xFE);
- s->next_rx_step = msg[2] & 0xFE;
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
+ s->next_rx_step = fcf;
/* Return to phase B */
queue_phase(s, T30_PHASE_B_TX);
switch (copy_quality(s))
@@ -3078,10 +3104,10 @@
case T30_PRI_EOM:
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, msg[2] & 0xFE);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
- s->next_rx_step = msg[2] & 0xFE;
+ s->next_rx_step = fcf;
switch (copy_quality(s))
{
case T30_COPY_QUALITY_PERFECT:
@@ -3106,8 +3132,8 @@
break;
case T30_EOP:
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, msg[2] & 0xFE);
- s->next_rx_step = msg[2] & 0xFE;
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
+ s->next_rx_step = fcf;
queue_phase(s, T30_PHASE_D_TX);
switch (copy_quality(s))
{
@@ -3137,10 +3163,10 @@
case T30_PRI_EOP:
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, msg[2] & 0xFE);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
- s->next_rx_step = msg[2] & 0xFE;
+ s->next_rx_step = fcf;
switch (copy_quality(s))
{
case T30_COPY_QUALITY_PERFECT:
@@ -3175,6 +3201,7 @@
break;
default:
/* We don't know what to do with this. */
+ s->current_status = T30_ERR_RX_INVALCMD;
unexpected_final_frame(s, msg, len);
break;
}
@@ -3183,10 +3210,12 @@
static void process_state_f_doc_and_post_doc_ecm(t30_state_t *s, const uint8_t *msg, int len)
{
+ uint8_t fcf;
uint8_t fcf2;
/* This actually handles 2 states - _DOC_ECM and _POST_DOC_ECM - as they are very similar */
- switch (msg[2] & 0xFE)
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_DIS:
process_rx_dis_dtc(s, msg, len);
@@ -3267,6 +3296,7 @@
break;
default:
/* We don't know what to do with this. */
+ s->current_status = T30_ERR_RX_INVALCMD;
unexpected_final_frame(s, msg, len);
break;
}
@@ -3275,7 +3305,10 @@
static void process_state_f_post_rcp_mcf(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_CRP:
repeat_last_command(s);
@@ -3296,7 +3329,10 @@
static void process_state_f_post_rcp_ppr(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_CRP:
repeat_last_command(s);
@@ -3314,7 +3350,10 @@
static void process_state_f_post_rcp_rnr(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_RR:
if (s->receiver_not_ready_count > 0)
@@ -3345,7 +3384,10 @@
static void process_state_r(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_DIS:
process_rx_dis_dtc(s, msg, len);
@@ -3374,7 +3416,10 @@
static void process_state_t(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_DIS:
process_rx_dis_dtc(s, msg, len);
@@ -3400,7 +3445,10 @@
static void process_state_i(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_CRP:
repeat_last_command(s);
@@ -3418,7 +3466,10 @@
static void process_state_ii(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_CRP:
repeat_last_command(s);
@@ -3437,8 +3488,10 @@
static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
{
t4_stats_t stats;
+ uint8_t fcf;
- switch (msg[2] & 0xFE)
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_MCF:
switch (s->next_tx_step)
@@ -3447,7 +3500,8 @@
case T30_PRI_MPS:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
+ /* Transmit the next page */
if (tx_start_page(s))
{
/* TODO: recover */
@@ -3461,7 +3515,7 @@
case T30_EOS:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
t4_tx_release(&(s->t4));
s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
if (span_log_test(&s->logging, SPAN_LOG_FLOW))
@@ -3475,7 +3529,7 @@
case T30_PRI_EOP:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
t4_tx_release(&(s->t4));
s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
send_dcn(s);
@@ -3488,13 +3542,16 @@
}
break;
case T30_RTP:
+#if 0
+ s->rtp_events++;
+#endif
switch (s->next_tx_step)
{
case T30_MPS:
case T30_PRI_MPS:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_RTP);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
if (tx_start_page(s))
{
/* TODO: recover */
@@ -3517,7 +3574,7 @@
case T30_EOS:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_RTP);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
t4_tx_release(&(s->t4));
/* TODO: should go back to T, and resend */
return_to_phase_b(s, TRUE);
@@ -3526,22 +3583,35 @@
case T30_PRI_EOP:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_RTP);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
t4_tx_release(&(s->t4));
- s->current_status = T30_ERR_TX_INVALRSP;
send_dcn(s);
break;
}
break;
case T30_RTN:
+#if 0
+ s->rtn_events++;
+#endif
switch (s->next_tx_step)
{
case T30_MPS:
case T30_PRI_MPS:
s->retries = 0;
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_RTN);
- /* Send fresh training, and then repeat the last page */
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
+#if 0
+ if (!s->retransmit_capable)
+#endif
+ {
+ /* Send the next page, regardless of the problem with the current one. */
+ if (tx_start_page(s))
+ {
+ /* TODO: recover */
+ break;
+ }
+ }
+ /* Send fresh training */
if (step_fallback_entry(s) < 0)
{
/* We have fallen back as far as we can go. Give up. */
@@ -3558,17 +3628,43 @@
case T30_EOS:
s->retries = 0;
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_RTN);
- s->current_status = T30_ERR_TX_INVALRSP;
- return_to_phase_b(s, TRUE);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
+#if 0
+ if (s->retransmit_capable)
+ {
+ /* Wait for DIS */
+ }
+ else
+#endif
+ {
+ return_to_phase_b(s, TRUE);
+ }
break;
case T30_EOP:
case T30_PRI_EOP:
s->retries = 0;
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_RTN);
- s->current_status = T30_ERR_TX_INVALRSP;
- send_dcn(s);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
+#if 0
+ if (s->retransmit_capable)
+ {
+ /* Send fresh training, and then repeat the last page */
+ if (step_fallback_entry(s) < 0)
+ {
+ /* We have fallen back as far as we can go. Give up. */
+ s->current_fallback = 0;
+ s->current_status = T30_ERR_CANNOT_TRAIN;
+ send_dcn(s);
+ break;
+ }
+ queue_phase(s, T30_PHASE_B_TX);
+ restart_sending_document(s);
+ }
+ else
+#endif
+ {
+ send_dcn(s);
+ }
break;
}
break;
@@ -3576,7 +3672,7 @@
s->retries = 0;
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, T30_PIP);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
break;
@@ -3584,7 +3680,7 @@
s->retries = 0;
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, T30_PIN);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
break;
@@ -3613,6 +3709,7 @@
break;
default:
/* We don't know what to do with this. */
+ s->current_status = T30_ERR_TX_INVALRSP;
unexpected_final_frame(s, msg, len);
break;
}
@@ -3621,7 +3718,10 @@
static void process_state_iii_q_mcf(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_EOP:
case T30_EOM:
@@ -3655,7 +3755,10 @@
static void process_state_iii_q_rtp(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_EOP:
case T30_EOM:
@@ -3686,7 +3789,10 @@
static void process_state_iii_q_rtn(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_EOP:
case T30_EOM:
@@ -3721,7 +3827,10 @@
static void process_state_iv(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_CRP:
repeat_last_command(s);
@@ -3740,8 +3849,10 @@
static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int len)
{
t4_stats_t stats;
+ uint8_t fcf;
- switch (msg[2] & 0xFE)
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_MCF:
s->retries = 0;
@@ -3765,7 +3876,7 @@
case T30_PRI_MPS:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
if (tx_start_page(s))
{
/* TODO: recover */
@@ -3783,7 +3894,7 @@
case T30_EOS:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
t4_tx_release(&(s->t4));
s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
if (span_log_test(&s->logging, SPAN_LOG_FLOW))
@@ -3797,7 +3908,7 @@
case T30_PRI_EOP:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
t4_tx_release(&(s->t4));
s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
send_dcn(s);
@@ -3842,8 +3953,10 @@
static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
{
t4_stats_t stats;
+ uint8_t fcf;
- switch (msg[2] & 0xFE)
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_MCF:
s->retries = 0;
@@ -3867,7 +3980,7 @@
case T30_PRI_MPS:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
if (tx_start_page(s))
{
/* TODO: recover */
@@ -3885,7 +3998,7 @@
case T30_EOS:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
t4_tx_release(&(s->t4));
s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
if (span_log_test(&s->logging, SPAN_LOG_FLOW))
@@ -3899,7 +4012,7 @@
case T30_PRI_EOP:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
t4_tx_release(&(s->t4));
s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
send_dcn(s);
@@ -3923,7 +4036,7 @@
s->retries = 0;
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, T30_PIP);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
break;
@@ -3931,7 +4044,7 @@
s->retries = 0;
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, T30_PIN);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
break;
@@ -3960,8 +4073,10 @@
static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len)
{
t4_stats_t stats;
+ uint8_t fcf;
- switch (msg[2] & 0xFE)
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_MCF:
s->retries = 0;
@@ -3985,7 +4100,7 @@
case T30_PRI_MPS:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
if (tx_start_page(s))
{
/* TODO: recover */
@@ -4003,7 +4118,7 @@
case T30_EOS:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
t4_tx_release(&(s->t4));
s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
if (span_log_test(&s->logging, SPAN_LOG_FLOW))
@@ -4017,7 +4132,7 @@
case T30_PRI_EOP:
tx_end_page(s);
if (s->phase_d_handler)
- s->phase_d_handler(s, s->phase_d_user_data, T30_MCF);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
t4_tx_release(&(s->t4));
s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
send_dcn(s);
@@ -4041,7 +4156,7 @@
s->retries = 0;
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, T30_PIP);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
break;
@@ -4049,7 +4164,7 @@
s->retries = 0;
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, T30_PIN);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
break;
@@ -4073,7 +4188,10 @@
static void process_state_iv_ctc(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_CTR:
/* Valid response to a CTC received */
@@ -4100,7 +4218,10 @@
static void process_state_iv_eor(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_RNR:
if (s->timer_t5 == 0)
@@ -4113,7 +4234,7 @@
s->retries = 0;
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, T30_PIN);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
break;
@@ -4138,7 +4259,10 @@
static void process_state_iv_eor_rnr(t30_state_t *s, const uint8_t *msg, int len)
{
- switch (msg[2] & 0xFE)
+ uint8_t fcf;
+
+ fcf = msg[2] & 0xFE;
+ switch (fcf)
{
case T30_RNR:
if (s->timer_t5 == 0)
@@ -4151,7 +4275,7 @@
s->retries = 0;
if (s->phase_d_handler)
{
- s->phase_d_handler(s, s->phase_d_user_data, T30_PIN);
+ s->phase_d_handler(s, s->phase_d_user_data, fcf);
s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
}
break;
@@ -4257,7 +4381,7 @@
}
else
{
- unexpected_frame(s, msg, len);
+ unexpected_non_final_frame(s, msg, len);
}
break;
case (T30_SEP & 0xFE):
@@ -4269,7 +4393,7 @@
}
else
{
- unexpected_frame(s, msg, len);
+ unexpected_non_final_frame(s, msg, len);
}
break;
case (T30_PSA & 0xFE):
@@ -4280,7 +4404,7 @@
}
else
{
- unexpected_frame(s, msg, len);
+ unexpected_non_final_frame(s, msg, len);
}
break;
case (T30_CIA & 0xFE):
@@ -4291,7 +4415,7 @@
}
else
{
- unexpected_frame(s, msg, len);
+ unexpected_non_final_frame(s, msg, len);
}
break;
case (T30_ISP & 0xFE):
@@ -4302,7 +4426,7 @@
}
else
{
- unexpected_frame(s, msg, len);
+ unexpected_non_final_frame(s, msg, len);
}
break;
case (T30_TSI & 0xFE):
@@ -5956,8 +6080,8 @@
t->error_correcting_mode = s->error_correcting_mode;
t->error_correcting_mode_retries = s->error_correcting_mode_retries;
t4_get_transfer_statistics(&s->t4, &stats);
- t->pages_tx = s->ecm_tx_page;
- t->pages_rx = s->ecm_rx_page;
+ t->pages_tx = s->tx_page_number;
+ t->pages_rx = s->rx_page_number;
t->pages_in_file = stats.pages_in_file;
t->width = stats.width;
t->length = stats.length;
@@ -5968,6 +6092,10 @@
t->encoding = stats.encoding;
t->image_size = stats.line_image_size;
t->current_status = s->current_status;
+#if 0
+ t->rtn_events = s->rtn_events;
+ t->rtp_events = s->rtp_events;
+#endif
}
/*- End of function --------------------------------------------------------*/
@@ -6000,9 +6128,13 @@
t30_build_dis_or_dtc(s);
memset(&s->rx_info, 0, sizeof(s->rx_info));
release_resources(s);
- /* The ECM page number is only reset at call establishment */
- s->ecm_rx_page = 0;
- s->ecm_tx_page = 0;
+ /* The page number is only reset at call establishment */
+ s->rx_page_number = 0;
+ s->tx_page_number = 0;
+#if 0
+ s->rtn_events = 0;
+ s->rtp_events = 0;
+#endif
s->far_end_detected = FALSE;
s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T0);
if (s->calling_party)
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/t31.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/t31.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/t31.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.151 2009/07/14 13:54:22 steveu Exp $
+ * $Id: t31.c,v 1.153 2009/10/05 16:33:25 steveu Exp $
*/
/*! \file */
@@ -176,12 +176,15 @@
static int restart_modem(t31_state_t *s, int new_modem);
static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int ok);
-static void set_rx_handler(t31_state_t *s, span_rx_handler_t *handler, void *user_data);
+static void set_rx_handler(t31_state_t *s, span_rx_handler_t *rx_handler, span_rx_fillin_handler_t *fillin_handler, void *user_data);
static void set_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data);
static void set_next_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data);
static int v17_v21_rx(void *user_data, const int16_t amp[], int len);
+static int v17_v21_rx_fillin(void *user_data, int len);
static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len);
+static int v27ter_v21_rx_fillin(void *user_data, int len);
static int v29_v21_rx(void *user_data, const int16_t amp[], int len);
+static int v29_v21_rx_fillin(void *user_data, int len);
static int silence_rx(void *user_data, const int16_t amp[], int len);
static int cng_rx(void *user_data, const int16_t amp[], int len);
static void non_ecm_put_bit(void *user_data, int bit);
@@ -1527,7 +1530,7 @@
s->at_state.rx_signal_present = FALSE;
s->at_state.rx_trained = FALSE;
s->rx_frame_received = FALSE;
- set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, NULL);
+ set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, NULL);
use_hdlc = FALSE;
switch (s->modem)
{
@@ -1546,7 +1549,7 @@
/* Do V.21/HDLC receive in parallel. The other end may send its
first message at any time. The CNG tone will continue until
we get a valid preamble. */
- set_rx_handler(s, (span_rx_handler_t *) &cng_rx, s);
+ set_rx_handler(s, (span_rx_handler_t *) &cng_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s);
t31_v21_rx(s);
set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx);
set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
@@ -1559,7 +1562,7 @@
}
else
{
- set_rx_handler(s, (span_rx_handler_t *) &cng_rx, s);
+ set_rx_handler(s, (span_rx_handler_t *) &cng_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s);
t31_v21_rx(s);
silence_gen_set(&t->silence_gen, 0);
set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
@@ -1610,7 +1613,7 @@
}
else
{
- set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, &t->v21_rx);
+ set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &t->v21_rx);
t31_v21_rx(s);
}
break;
@@ -1652,7 +1655,7 @@
case FAX_MODEM_V17_RX:
if (!s->t38_mode)
{
- set_rx_handler(s, (span_rx_handler_t *) &v17_v21_rx, s);
+ set_rx_handler(s, (span_rx_handler_t *) &v17_v21_rx, (span_rx_fillin_handler_t *) &v17_v21_rx_fillin, s);
v17_rx_restart(&t->v17_rx, s->bit_rate, s->short_train);
/* Allow for +FCERROR/+FRH:3 */
t31_v21_rx(s);
@@ -1689,7 +1692,7 @@
case FAX_MODEM_V27TER_RX:
if (!s->t38_mode)
{
- set_rx_handler(s, (span_rx_handler_t *) &v27ter_v21_rx, s);
+ set_rx_handler(s, (span_rx_handler_t *) &v27ter_v21_rx, (span_rx_fillin_handler_t *) &v27ter_v21_rx_fillin, s);
v27ter_rx_restart(&t->v27ter_rx, s->bit_rate, FALSE);
/* Allow for +FCERROR/+FRH:3 */
t31_v21_rx(s);
@@ -1726,7 +1729,7 @@
case FAX_MODEM_V29_RX:
if (!s->t38_mode)
{
- set_rx_handler(s, (span_rx_handler_t *) &v29_v21_rx, s);
+ set_rx_handler(s, (span_rx_handler_t *) &v29_v21_rx, (span_rx_fillin_handler_t *) &v29_v21_rx_fillin, s);
v29_rx_restart(&t->v29_rx, s->bit_rate, FALSE);
/* Allow for +FCERROR/+FRH:3 */
t31_v21_rx(s);
@@ -1752,7 +1755,7 @@
case FAX_MODEM_SILENCE_RX:
if (!s->t38_mode)
{
- set_rx_handler(s, (span_rx_handler_t *) &silence_rx, s);
+ set_rx_handler(s, (span_rx_handler_t *) &silence_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s);
silence_gen_set(&t->silence_gen, 0);
set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen);
set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
@@ -2113,7 +2116,7 @@
s->at_state.rx_data_bytes = 0;
s->at_state.transmit = FALSE;
s->modem = FAX_MODEM_SILENCE_TX;
- set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, NULL);
+ set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, NULL);
t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK);
}
@@ -2136,9 +2139,13 @@
}
/*- End of function --------------------------------------------------------*/
-static void set_rx_handler(t31_state_t *s, span_rx_handler_t *handler, void *user_data)
+static void set_rx_handler(t31_state_t *s,
+ span_rx_handler_t *rx_handler,
+ span_rx_fillin_handler_t *fillin_handler,
+ void *user_data)
{
- s->audio.modems.rx_handler = handler;
+ s->audio.modems.rx_handler = rx_handler;
+ s->audio.modems.rx_fillin_handler = fillin_handler;
s->audio.modems.rx_user_data = user_data;
}
/*- End of function --------------------------------------------------------*/
@@ -2208,7 +2215,7 @@
/* The fast modem has trained, so we no longer need to run the slow
one in parallel. */
span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx));
- set_rx_handler(t, (span_rx_handler_t *) &v17_rx, &s->v17_rx);
+ set_rx_handler(t, (span_rx_handler_t *) &v17_rx, (span_rx_fillin_handler_t *) &v17_rx_fillin, &s->v17_rx);
}
else
{
@@ -2218,13 +2225,26 @@
/* We have received something, and the fast modem has not trained. We must
be receiving valid V.21 */
span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
- set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
+ set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx);
}
}
return len;
}
/*- End of function --------------------------------------------------------*/
+static int v17_v21_rx_fillin(void *user_data, int len)
+{
+ t31_state_t *t;
+ fax_modems_state_t *s;
+
+ t = (t31_state_t *) user_data;
+ s = &t->audio.modems;
+ v17_rx_fillin(&s->v17_rx, len);
+ fsk_rx_fillin(&s->v21_rx, len);
+ return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len)
{
t31_state_t *t;
@@ -2238,7 +2258,7 @@
/* The fast modem has trained, so we no longer need to run the slow
one in parallel. */
span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx));
- set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, &s->v27ter_rx);
+ set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, (span_rx_fillin_handler_t *) &v27ter_rx_fillin, &s->v27ter_rx);
}
else
{
@@ -2248,13 +2268,26 @@
/* We have received something, and the fast modem has not trained. We must
be receiving valid V.21 */
span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
- set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
+ set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx);
}
}
return len;
}
/*- End of function --------------------------------------------------------*/
+static int v27ter_v21_rx_fillin(void *user_data, int len)
+{
+ t31_state_t *t;
+ fax_modems_state_t *s;
+
+ t = (t31_state_t *) user_data;
+ s = &t->audio.modems;
+ v27ter_rx_fillin(&s->v27ter_rx, len);
+ fsk_rx_fillin(&s->v21_rx, len);
+ return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
static int v29_v21_rx(void *user_data, const int16_t amp[], int len)
{
t31_state_t *t;
@@ -2268,7 +2301,7 @@
/* The fast modem has trained, so we no longer need to run the slow
one in parallel. */
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx));
- set_rx_handler(t, (span_rx_handler_t *) &v29_rx, &s->v29_rx);
+ set_rx_handler(t, (span_rx_handler_t *) &v29_rx, (span_rx_fillin_handler_t *) &v29_rx_fillin, &s->v29_rx);
}
else
{
@@ -2278,13 +2311,26 @@
/* We have received something, and the fast modem has not trained. We must
be receiving valid V.21 */
span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
- set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx);
+ set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx);
}
}
return len;
}
/*- End of function --------------------------------------------------------*/
+static int v29_v21_rx_fillin(void *user_data, int len)
+{
+ t31_state_t *t;
+ fax_modems_state_t *s;
+
+ t = (t31_state_t *) user_data;
+ s = &t->audio.modems;
+ v29_rx_fillin(&s->v29_rx, len);
+ fsk_rx_fillin(&s->v21_rx, len);
+ return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
SPAN_DECLARE(int) t31_rx(t31_state_t *s, int16_t amp[], int len)
{
int i;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/t38_non_ecm_buffer.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/t38_non_ecm_buffer.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/t38_non_ecm_buffer.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.8 2009/02/10 13:06:46 steveu Exp $
+ * $Id: t38_non_ecm_buffer.c,v 1.9 2009/10/05 16:33:25 steveu Exp $
*/
/*! \file */
@@ -46,9 +46,6 @@
#endif
#include "floating_fudge.h"
#include <assert.h>
-#if defined(LOG_FAX_AUDIO)
-#include <unistd.h>
-#endif
#include "spandsp/telephony.h"
#include "spandsp/logging.h"
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/t38_terminal.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/t38_terminal.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/src/t38_terminal.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.127 2009/07/14 13:54:22 steveu Exp $
+ * $Id: t38_terminal.c,v 1.128 2009/09/04 14:38:46 steveu Exp $
*/
/*! \file */
@@ -93,9 +93,9 @@
enum
{
- T38_CHUNKING_MERGE_FCS_WITH_DATA = 0x0001,
- T38_CHUNKING_WHOLE_FRAMES = 0x0002,
- T38_CHUNKING_ALLOW_TEP_TIME = 0x0004
+ T38_CHUNKING_MERGE_FCS_WITH_DATA = 0x0001,
+ T38_CHUNKING_WHOLE_FRAMES = 0x0002,
+ T38_CHUNKING_ALLOW_TEP_TIME = 0x0004
};
enum
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/Makefile.am (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/Makefile.am 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/Makefile.am 2009-11-02 10:10:22 UTC (rev 15314)
@@ -16,7 +16,7 @@
## 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.116 2009/05/30 15:23:13 steveu Exp $
+## $Id: Makefile.am,v 1.117 2009/09/22 13:11:04 steveu Exp $
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
@@ -99,6 +99,7 @@
sig_tone_tests \
super_tone_rx_tests \
super_tone_tx_tests \
+ swept_tone_tests \
t4_tests \
t31_tests \
t38_core_tests \
@@ -273,6 +274,9 @@
super_tone_tx_tests_SOURCES = super_tone_tx_tests.c
super_tone_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
+swept_tone_tests_SOURCES = swept_tone_tests.c
+swept_tone_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
+
t4_tests_SOURCES = t4_tests.c
t4_tests_LDADD = $(LIBDIR) -lspandsp
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/fax_decode.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/fax_decode.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/fax_decode.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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.56 2009/05/30 15:23:13 steveu Exp $
+ * $Id: fax_decode.c,v 1.57 2009/09/15 14:01:53 steveu Exp $
*/
/*! \page fax_decode_page FAX decoder
@@ -124,7 +124,7 @@
type = fr[2] & 0xFE;
if (type == T30_DIS || type == T30_DTC || type == T30_DCS)
t30_decode_dis_dtc_dcs(&t30_dummy, fr, frlen);
- if (type == T30_NSF)
+ if (type == T30_NSF || type == T30_NSS || type == T30_NSC)
{
if (t35_decode(&fr[3], frlen - 3, &country, &vendor, &model))
{
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/line_model_tests.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/line_model_tests.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/line_model_tests.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: line_model_tests.c,v 1.27 2009/05/30 15:23:14 steveu Exp $
+ * $Id: line_model_tests.c,v 1.28 2009/09/23 16:02:59 steveu Exp $
*/
/*! \page line_model_tests_page Telephony line model tests
@@ -62,7 +62,7 @@
#define IN_FILE_NAME1 "line_model_test_in1.wav"
#define IN_FILE_NAME2 "line_model_test_in2.wav"
#define OUT_FILE_NAME1 "line_model_one_way_test_out.wav"
-#define OUT_FILE_NAME "line_model_test_out.wav"
+#define OUT_FILE_NAME2 "line_model_two_way_test_out.wav"
int channel_codec;
int rbs_pattern;
@@ -128,11 +128,18 @@
awgn_init_dbm0(&noise1, 1234567, -10.0f);
- if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
+ if (speech_test)
{
- fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME1);
- exit(2);
+ if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
+ {
+ fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME1);
+ exit(2);
+ }
}
+ else
+ {
+ inhandle1 = NULL;
+ }
if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME1, 1)) == NULL)
{
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME1);
@@ -167,10 +174,13 @@
exit(2);
}
}
- if (sf_close(inhandle1))
+ if (speech_test)
{
- fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME1);
- exit(2);
+ if (sf_close(inhandle1))
+ {
+ fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME1);
+ exit(2);
+ }
}
if (sf_close(outhandle))
{
@@ -208,19 +218,27 @@
awgn_init_dbm0(&noise1, 1234567, -10.0f);
awgn_init_dbm0(&noise2, 1234567, -10.0f);
- if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
+ if (speech_test)
{
- fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME1);
- exit(2);
+ if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
+ {
+ fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME1);
+ exit(2);
+ }
+ if ((inhandle2 = sf_open_telephony_read(IN_FILE_NAME2, 1)) == NULL)
+ {
+ fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME2);
+ exit(2);
+ }
}
- if ((inhandle2 = sf_open_telephony_read(IN_FILE_NAME2, 1)) == NULL)
+ else
{
- fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME2);
- exit(2);
+ inhandle1 =
+ inhandle2 = NULL;
}
- if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 2)) == NULL)
+ if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME2, 2)) == NULL)
{
- fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME);
+ fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME2);
exit(2);
}
for (i = 0; i < 10000; i++)
@@ -261,25 +279,80 @@
exit(2);
}
}
- if (sf_close(inhandle1))
+ if (speech_test)
{
- fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME1);
- exit(2);
+ if (sf_close(inhandle1))
+ {
+ fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME1);
+ exit(2);
+ }
+ if (sf_close(inhandle2))
+ {
+ fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME2);
+ exit(2);
+ }
}
- if (sf_close(inhandle2))
- {
- fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME2);
- exit(2);
- }
if (sf_close(outhandle))
{
- fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME);
+ fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME2);
exit(2);
}
both_ways_line_model_release(model);
}
/*- End of function --------------------------------------------------------*/
+static void test_line_filter(int line_model_no)
+{
+ float out;
+ double sumin;
+ double sumout;
+ int i;
+ int j;
+ int p;
+ int ptr;
+ int len;
+ swept_tone_state_t *s;
+ float filter[129];
+ int16_t buf[BLOCK_LEN];
+
+ s = swept_tone_init(NULL, 200.0f, 3900.0f, -10.0f, 120*SAMPLE_RATE, 0);
+ for (j = 0; j < 129; j++)
+ filter[j] = 0.0f;
+ ptr = 0;
+ for (;;)
+ {
+ if ((len = swept_tone(s, buf, BLOCK_LEN)) <= 0)
+ break;
+ sumin = 0.0;
+ sumout = 0.0;
+ for (i = 0; i < len; i++)
+ {
+ /* Add the sample in the filter buffer */
+ p = ptr;
+ filter[p] = buf[i];
+ if (++p == 129)
+ p = 0;
+ ptr = p;
+
+ /* Apply the filter */
+ out = 0.0f;
+ for (j = 0; j < 129; j++)
+ {
+ out += line_models[line_model_no][128 - j]*filter[p];
+ if (++p >= 129)
+ p = 0;
+ }
+ sumin += buf[i]*buf[i];
+ sumout += out*out;
+ }
+ /*endfor*/
+ printf("%7.1f %f\n", swept_tone_current_frequency(s), 10.0*log10(sumout/sumin));
+ }
+ /*endfor*/
+ swept_tone_free(s);
+}
+/*- End of function --------------------------------------------------------*/
+
int main(int argc, char *argv[])
{
int line_model_no;
@@ -319,6 +392,7 @@
complexify_tests();
test_one_way_model(line_model_no, speech_test);
test_both_ways_model(line_model_no, speech_test);
+ test_line_filter(line_model_no);
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/regression_tests.sh (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/regression_tests.sh 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/regression_tests.sh 2009-11-02 10:10:22 UTC (rev 15314)
@@ -17,7 +17,7 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
-# $Id: regression_tests.sh,v 1.58 2009/05/19 14:47:02 steveu Exp $
+# $Id: regression_tests.sh,v 1.59 2009/09/22 13:28:18 steveu Exp $
#
ITUTESTS_TIF=../test-data/itu/fax/itutests.tif
@@ -468,6 +468,16 @@
#echo super_tone_tx_tests completed OK
echo super_tone_tx_tests not enabled
+#./swept_tone_tests >$STDOUT_DEST 2>$STDERR_DEST
+#RETVAL=$?
+#if [ $RETVAL != 0 ]
+#then
+# echo swept_tone_tests failed!
+# exit $RETVAL
+#fi
+#echo swept_tone_tests completed OK
+echo swept_tone_tests not enabled
+
./t31_tests -r >$STDOUT_DEST 2>$STDERR_DEST
RETVAL=$?
if [ $RETVAL != 0 ]
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/sig_tone_tests.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/sig_tone_tests.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/sig_tone_tests.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -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: sig_tone_tests.c,v 1.25 2009/05/30 15:23:14 steveu Exp $
+ * $Id: sig_tone_tests.c,v 1.27 2009/09/23 16:02:59 steveu Exp $
*/
/*! \file */
@@ -58,112 +58,97 @@
static int sampleno = 0;
static int tone_1_present = 0;
static int tone_2_present = 0;
-static int ping = 0;
+static int tx_section = 0;
+static int dial_pulses = 0;
-void map_frequency_response(sig_tone_rx_state_t *s);
-
-static int tx_handler(void *user_data, int what)
+static void tx_handler(void *user_data, int what, int level, int duration)
{
- //printf("What - %d\n", what);
- if ((what & SIG_TONE_UPDATE_REQUEST))
+ sig_tone_tx_state_t *s;
+
+ s = (sig_tone_tx_state_t *) user_data;
+ //printf("What - %d, duration - %d\n", what, duration);
+ if ((what & SIG_TONE_TX_UPDATE_REQUEST))
{
printf("Tx: update request\n");
- /* The signaling processor wants to know what to do next */
- if (sampleno < ms_to_samples(100))
+ /* The sig tone transmit side wants to know what to do next */
+ switch (tx_section)
{
- /* 100ms off-hook */
- printf("100ms off-hook - %d samples\n", 800 - sampleno);
- return 0x02 | ((ms_to_samples(100) - sampleno) << 16);
- }
- else if (sampleno < ms_to_samples(600))
- {
- /* 500ms idle */
- printf("500ms idle - %d samples\n", ms_to_samples(600) - sampleno);
- return 0x02 | SIG_TONE_1_PRESENT | ((ms_to_samples(600) - sampleno) << 16);
- }
- else if (sampleno < ms_to_samples(700))
- {
- /* 100ms seize */
- printf("100ms seize - %d samples\n", ms_to_samples(700) - sampleno);
- return 0x02 | ((ms_to_samples(700) - sampleno) << 16);
- }
- else if (sampleno < ms_to_samples(1700))
- {
- if (ping)
- {
- printf("33ms break - %d samples\n", ms_to_samples(33));
- ping = !ping;
- return 0x02 | (ms_to_samples(33) << 16);
- }
+ case 0:
+ printf("33ms break - %d samples\n", ms_to_samples(33));
+ tx_section++;
+ sig_tone_tx_set_mode(s, SIG_TONE_1_PRESENT, ms_to_samples(33));
+ break;
+ case 1:
+ printf("67ms make - %d samples\n", ms_to_samples(67));
+ if (++dial_pulses == 9)
+ tx_section++;
else
- {
- printf("67ms make - %d samples\n", ms_to_samples(67));
- ping = !ping;
- return 0x02 | SIG_TONE_1_PRESENT | (ms_to_samples(67) << 16);
- }
- /*endif*/
+ tx_section--;
+ sig_tone_tx_set_mode(s, 0, ms_to_samples(67));
+ break;
+ case 2:
+ tx_section++;
+ sig_tone_tx_set_mode(s, SIG_TONE_1_PRESENT, ms_to_samples(600));
+ break;
+ case 3:
+ sig_tone_tx_set_mode(s, SIG_TONE_1_PRESENT | SIG_TONE_TX_PASSTHROUGH, 0);
+ break;
}
- else
- {
- return 0x02 | SIG_TONE_1_PRESENT | ((ms_to_samples(700) - sampleno) << 16) | SIG_TONE_TX_PASSTHROUGH;
- }
- /*endif*/
+ /*endswitch*/
}
/*endif*/
- return 0;
}
/*- End of function --------------------------------------------------------*/
-static int rx_handler(void *user_data, int what)
+static void rx_handler(void *user_data, int what, int level, int duration)
{
- //printf("What - %d\n", what);
+ float ms;
+
+ ms = 1000.0f*(float) duration/(float) SAMPLE_RATE;
+ printf("What - %d, duration - %d\n", what, duration);
if ((what & SIG_TONE_1_CHANGE))
{
tone_1_present = what & SIG_TONE_1_PRESENT;
- printf("Rx: tone 1 is %s after %d samples\n", (tone_1_present) ? "on" : "off", (what >> 16) & 0xFFFF);
+ printf("Rx: tone 1 is %s after %d samples (%fms)\n", (tone_1_present) ? "on" : "off", duration, ms);
}
/*endif*/
if ((what & SIG_TONE_2_CHANGE))
{
tone_2_present = what & SIG_TONE_2_PRESENT;
- printf("Rx: tone 2 is %s after %d samples\n", (tone_2_present) ? "on" : "off", (what >> 16) & 0xFFFF);
+ printf("Rx: tone 2 is %s after %d samples (%fms)\n", (tone_2_present) ? "on" : "off", duration, ms);
}
/*endif*/
- return 0;
}
/*- End of function --------------------------------------------------------*/
-void map_frequency_response(sig_tone_rx_state_t *s)
+static void map_frequency_response(sig_tone_rx_state_t *s)
{
int16_t buf[8192];
- awgn_state_t noise_source;
int i;
- int f;
- uint32_t phase_acc;
- int32_t phase_rate;
- int32_t scaling;
- double sum;
+ int len;
+ double sumin;
+ double sumout;
+ swept_tone_state_t *swept;
/* Things like noise don't highlight the frequency response of the high Q notch
very well. We use a slowly swept frequency to check it. */
- awgn_init_dbm0(&noise_source, 1234567, -10.0f);
- for (f = 1; f < 4000; f++)
+ swept = swept_tone_init(NULL, 200.0f, 3900.0f, -10.0f, 120*SAMPLE_RATE, 0);
+ for (;;)
{
- phase_rate = dds_phase_rate(f);
- scaling = dds_scaling_dbm0(-10);
- phase_acc = 0;
- for (i = 0; i < 8192; i++)
- buf[i] = dds_mod(&phase_acc, phase_rate, scaling, 0);
+ if ((len = swept_tone(swept, buf, SAMPLES_PER_CHUNK)) <= 0)
+ break;
+ sumin = 0.0;
+ for (i = 0; i < len; i++)
+ sumin += (double) buf[i]*(double) buf[i];
+ sig_tone_rx(s, buf, len);
+ sumout = 0.0;
+ for (i = 0; i < len; i++)
+ sumout += (double) buf[i]*(double) buf[i];
/*endfor*/
- sig_tone_rx(s, buf, 8192);
- sum = 0.0;
- for (i = 1000; i < 8192; i++)
- sum += (double) buf[i]*(double) buf[i];
- /*endfor*/
- sum = sqrt(sum);
- printf("%7d %f\n", f, sum);
+ printf("%7.1f %f\n", swept_tone_current_frequency(swept), 10.0*log10(sumout/sumin));
}
/*endfor*/
+ swept_tone_free(swept);
}
/*- End of function --------------------------------------------------------*/
@@ -189,45 +174,56 @@
}
/*endif*/
- awgn_init_dbm0(&noise_source, 1234567, -10.0f);
+ awgn_init_dbm0(&noise_source, 1234567, -20.0f);
for (type = 1; type <= 3; type++)
{
sampleno = 0;
tone_1_present = 0;
tone_2_present = 0;
- ping = 0;
+ tx_section = 0;
munge = NULL;
switch (type)
{
case 1:
printf("2280Hz tests.\n");
munge = codec_munge_init(MUNGE_CODEC_ALAW, 0);
- sig_tone_tx_init(&tx_state, SIG_TONE_2280HZ, tx_handler, NULL);
- sig_tone_rx_init(&rx_state, SIG_TONE_2280HZ, rx_handler, NULL);
+ sig_tone_tx_init(&tx_state, SIG_TONE_2280HZ, tx_handler, &tx_state);
+ sig_tone_rx_init(&rx_state, SIG_TONE_2280HZ, rx_handler, &rx_state);
rx_state.current_rx_tone |= SIG_TONE_RX_PASSTHROUGH;
break;
case 2:
- printf("26000Hz tests.\n");
+ printf("2600Hz tests.\n");
munge = codec_munge_init(MUNGE_CODEC_ULAW, 0);
- sig_tone_tx_init(&tx_state, SIG_TONE_2600HZ, tx_handler, NULL);
- sig_tone_rx_init(&rx_state, SIG_TONE_2600HZ, rx_handler, NULL);
+ sig_tone_tx_init(&tx_state, SIG_TONE_2600HZ, tx_handler, &tx_state);
+ sig_tone_rx_init(&rx_state, SIG_TONE_2600HZ, rx_handler, &rx_state);
rx_state.current_rx_tone |= SIG_TONE_RX_PASSTHROUGH;
break;
case 3:
- printf("2400Hz/26000Hz tests.\n");
+ printf("2400Hz/2600Hz tests.\n");
munge = codec_munge_init(MUNGE_CODEC_ULAW, 0);
- sig_tone_tx_init(&tx_state, SIG_TONE_2400HZ_2600HZ, tx_handler, NULL);
- sig_tone_rx_init(&rx_state, SIG_TONE_2400HZ_2600HZ, rx_handler, NULL);
+ sig_tone_tx_init(&tx_state, SIG_TONE_2400HZ_2600HZ, tx_handler, &tx_state);
+ sig_tone_rx_init(&rx_state, SIG_TONE_2400HZ_2600HZ, rx_handler, &rx_state);
rx_state.current_rx_tone |= SIG_TONE_RX_PASSTHROUGH;
break;
}
/*endswitch*/
-
- //map_frequency_response(&rx_state);
+ /* Set to the default of hook condition */
+ sig_tone_rx_set_mode(&rx_state, SIG_TONE_RX_PASSTHROUGH | SIG_TONE_RX_FILTER_TONE, 0);
+ sig_tone_tx_set_mode(&tx_state, SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT | SIG_TONE_TX_PASSTHROUGH, 0);
- for (sampleno = 0; sampleno < 20000; sampleno += SAMPLES_PER_CHUNK)
+ map_frequency_response(&rx_state);
+
+ sig_tone_rx_set_mode(&rx_state, SIG_TONE_RX_PASSTHROUGH, 0);
+ for (sampleno = 0; sampleno < 30000; sampleno += SAMPLES_PER_CHUNK)
{
+ if (sampleno == 8000)
+ {
+ /* 100ms seize */
+ printf("100ms seize - %d samples\n", ms_to_samples(100));
+ dial_pulses = 0;
+ sig_tone_tx_set_mode(&tx_state, 0, ms_to_samples(100));
+ }
for (i = 0; i < SAMPLES_PER_CHUNK; i++)
amp[i] = awgn(&noise_source);
/*endfor*/
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/swept_tone_tests.c (from rev 15313, freeswitch/trunk/libs/spandsp/tests/swept_tone_tests.c) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/swept_tone_tests.c (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/spandsp/tests/swept_tone_tests.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,101 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * swept_tone_tests.c
+ *
+ * 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 General Public License version 2, 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: swept_tone_tests.c,v 1.2 2009/09/22 13:28:18 steveu Exp $
+ */
+
+/*! \file */
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <memory.h>
+#include <sndfile.h>
+
+#include "spandsp.h"
+#include "spandsp-sim.h"
+
+#define OUTPUT_FILE_NAME "swept_tone.wav"
+
+#define BLOCK_LEN 160
+
+int main(int argc, char *argv[])
+{
+ int i;
+ int j;
+ int outframes;
+ int len;
+ SNDFILE *outhandle;
+ power_meter_t meter;
+ swept_tone_state_t *s;
+ int16_t buf[BLOCK_LEN];
+
+ power_meter_init(&meter, 10);
+
+ if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
+ {
+ fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME);
+ exit(2);
+ }
+
+ printf("Test with swept tone.\n");
+ s = swept_tone_init(NULL, 200.0f, 3900.0f, -10.0f, 60*SAMPLE_RATE, 1);
+ for (j = 0; j < 60*SAMPLE_RATE; j += BLOCK_LEN)
+ {
+ len = swept_tone(s, buf, BLOCK_LEN);
+ for (i = 0; i < len; i++)
+ power_meter_update(&meter, buf[i]);
+ outframes = sf_writef_short(outhandle, buf, len);
+ if (outframes != len)
+ {
+ fprintf(stderr, " Error writing audio file\n");
+ exit(2);
+ }
+#if 0
+ printf("Current freq %.1fHz, Level is %fdBOv/%fdBm0\n",
+ swept_tone_current_frequency(s),
+ power_meter_current_dbov(&meter),
+ power_meter_current_dbm0(&meter));
+#else
+ printf("%.1f %f\n",
+ swept_tone_current_frequency(s),
+ power_meter_current_dbm0(&meter));
+#endif
+ }
+
+ if (sf_close(outhandle) != 0)
+ {
+ fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
+ exit(2);
+ }
+
+ printf("Tests passed.\n");
+ return 0;
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2
Name: svn:ignore
- config.log
config.status
libtool
Makefile
+ config.log
config.status
libtool
Makefile
configure
Makefile.in
autom4te.cache
aclocal.m4
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/.update (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/.update 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/.update 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1 +1 @@
-Wed Jul 22 15:05:52 EDT 2009
+Mon Oct 5 09:57:20 CDT 2009
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/Makefile.am (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/Makefile.am 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/Makefile.am 2009-11-02 10:10:22 UTC (rev 15314)
@@ -26,7 +26,7 @@
docdir = $(LIBTIFF_DOCDIR)
AUTOMAKE_OPTIONS = dist-zip foreign
-ACLOCAL_AMFLAGS = -I ./m4
+ACLOCAL_AMFLAGS = -I m4
docfiles = \
COPYRIGHT \
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/Makefile.in
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/acinclude.m4 (from rev 15313, freeswitch/trunk/libs/tiff-3.8.2/acinclude.m4) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/acinclude.m4 (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/acinclude.m4 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,669 @@
+dnl ---------------------------------------------------------------------------
+dnl Message output
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([LOC_MSG],[echo "$1"])
+
+dnl ---------------------------------------------------------------------------
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/vl_prog_cc_warnings.html
+dnl ---------------------------------------------------------------------------
+
+dnl @synopsis VL_PROG_CC_WARNINGS([ANSI])
+dnl
+dnl Enables a reasonable set of warnings for the C compiler.
+dnl Optionally, if the first argument is nonempty, turns on flags which
+dnl enforce and/or enable proper ANSI C if such are known with the
+dnl compiler used.
+dnl
+dnl Currently this macro knows about GCC, Solaris C compiler, Digital
+dnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
+dnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
+dnl 10.0.0.8) C compiler.
+dnl
+dnl @category C
+dnl @author Ville Laurikari <vl@iki.fi>
+dnl @version 2002-04-04
+dnl @license AllPermissive
+
+AC_DEFUN([VL_PROG_CC_WARNINGS], [
+ ansi=$1
+ if test -z "$ansi"; then
+ msg="for C compiler warning flags"
+ else
+ msg="for C compiler warning and ANSI conformance flags"
+ fi
+ AC_CACHE_CHECK($msg, vl_cv_prog_cc_warnings, [
+ if test -n "$CC"; then
+ cat > conftest.c <<EOF
+int main(int argc, char **argv) { return 0; }
+EOF
+
+ dnl GCC. -W option has been renamed in -wextra in latest gcc versions.
+ if test "$GCC" = "yes"; then
+ if test -z "$ansi"; then
+ vl_cv_prog_cc_warnings="-Wall -W"
+ else
+ vl_cv_prog_cc_warnings="-Wall -W -ansi -pedantic"
+ fi
+
+ dnl Most compilers print some kind of a version string with some command
+ dnl line options (often "-V"). The version string should be checked
+ dnl before doing a test compilation run with compiler-specific flags.
+ dnl This is because some compilers (like the Cray compiler) only
+ dnl produce a warning message for unknown flags instead of returning
+ dnl an error, resulting in a false positive. Also, compilers may do
+ dnl erratic things when invoked with flags meant for a different
+ dnl compiler.
+
+ dnl Solaris C compiler
+ elif $CC -V 2>&1 | grep -i "WorkShop" > /dev/null 2>&1 &&
+ $CC -c -v -Xc conftest.c > /dev/null 2>&1 &&
+ test -f conftest.o; then
+ if test -z "$ansi"; then
+ vl_cv_prog_cc_warnings="-v"
+ else
+ vl_cv_prog_cc_warnings="-v -Xc"
+ fi
+
+ dnl Digital Unix C compiler
+ elif $CC -V 2>&1 | grep -i "Digital UNIX Compiler" > /dev/null 2>&1 &&
+ $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 &&
+ test -f conftest.o; then
+ if test -z "$ansi"; then
+ vl_cv_prog_cc_warnings="-verbose -w0 -warnprotos"
+ else
+ vl_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1"
+ fi
+
+ dnl C for AIX Compiler
+ elif $CC 2>&1 | grep -i "C for AIX Compiler" > /dev/null 2>&1 &&
+ $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 &&
+ test -f conftest.o; then
+ if test -z "$ansi"; then
+ vl_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd"
+ else
+ vl_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi"
+ fi
+
+ dnl IRIX C compiler
+ elif $CC -version 2>&1 | grep -i "MIPSpro Compilers" > /dev/null 2>&1 &&
+ $CC -c -fullwarn -ansi -ansiE conftest.c > /dev/null 2>&1 &&
+ test -f conftest.o; then
+ if test -z "$ansi"; then
+ vl_cv_prog_cc_warnings="-fullwarn"
+ else
+ vl_cv_prog_cc_warnings="-fullwarn -ansi -ansiE"
+ fi
+
+ dnl HP-UX C compiler
+ elif what $CC 2>&1 | grep -i "HP C Compiler" > /dev/null 2>&1 &&
+ $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 &&
+ test -f conftest.o; then
+ if test -z "$ansi"; then
+ vl_cv_prog_cc_warnings="+w1"
+ else
+ vl_cv_prog_cc_warnings="+w1 -Aa"
+ fi
+
+ dnl The NEC SX-5 (Super-UX 10) C compiler
+ elif $CC -V 2>&1 | grep "/SX" > /dev/null 2>&1 &&
+ $CC -c -pvctl[,]fullmsg -Xc conftest.c > /dev/null 2>&1 &&
+ test -f conftest.o; then
+ if test -z "$ansi"; then
+ vl_cv_prog_cc_warnings="-pvctl[,]fullmsg"
+ else
+ vl_cv_prog_cc_warnings="-pvctl[,]fullmsg -Xc"
+ fi
+
+ dnl The Cray C compiler (Unicos)
+ elif $CC -V 2>&1 | grep -i "Cray" > /dev/null 2>&1 &&
+ $CC -c -h msglevel 2 conftest.c > /dev/null 2>&1 &&
+ test -f conftest.o; then
+ if test -z "$ansi"; then
+ vl_cv_prog_cc_warnings="-h msglevel 2"
+ else
+ vl_cv_prog_cc_warnings="-h msglevel 2 -h conform"
+ fi
+
+ fi
+ rm -f conftest.*
+ fi
+ if test -n "$vl_cv_prog_cc_warnings"; then
+ CFLAGS="$CFLAGS $vl_cv_prog_cc_warnings"
+ else
+ vl_cv_prog_cc_warnings="unknown"
+ fi
+ ])
+])dnl
+
+dnl ---------------------------------------------------------------------------
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://autoconf-archive.cryp.to/ax_lang_compiler_ms.html
+dnl ---------------------------------------------------------------------------
+
+dnl @synopsis AX_LANG_COMPILER_MS
+dnl
+dnl Check whether the compiler for the current language is Microsoft.
+dnl
+dnl This macro is modeled after _AC_LANG_COMPILER_GNU in the GNU
+dnl Autoconf implementation.
+dnl
+dnl @category InstalledPackages
+dnl @author Braden McDaniel <braden@endoframe.com>
+dnl @version 2004-11-15
+dnl @license AllPermissive
+
+AC_DEFUN([AX_LANG_COMPILER_MS],
+[AC_CACHE_CHECK([whether we are using the Microsoft _AC_LANG compiler],
+ [ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef _MSC_VER
+ choke me
+#endif
+]])],
+ [ax_compiler_ms=yes],
+ [ax_compiler_ms=no])
+ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms=$ax_compiler_ms
+])])
+
+dnl ---------------------------------------------------------------------------
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/ax_check_gl.html
+dnl ---------------------------------------------------------------------------
+
+dnl @synopsis AX_CHECK_GL
+dnl
+dnl Check for an OpenGL implementation. If GL is found, the required
+dnl compiler and linker flags are included in the output variables
+dnl "GL_CFLAGS" and "GL_LIBS", respectively. This macro adds the
+dnl configure option "--with-apple-opengl-framework", which users can
+dnl use to indicate that Apple's OpenGL framework should be used on Mac
+dnl OS X. If Apple's OpenGL framework is used, the symbol
+dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GL implementation
+dnl is found, "no_gl" is set to "yes".
+dnl
+dnl @category InstalledPackages
+dnl @author Braden McDaniel <braden@endoframe.com>
+dnl @version 2004-11-15
+dnl @license AllPermissive
+
+AC_DEFUN([AX_CHECK_GL],
+[AC_REQUIRE([AC_PATH_X])dnl
+AC_REQUIRE([ACX_PTHREAD])dnl
+
+#
+# There isn't a reliable way to know we should use the Apple OpenGL framework
+# without a configure option. A Mac OS X user may have installed an
+# alternative GL implementation (e.g., Mesa), which may or may not depend on X.
+#
+AC_ARG_WITH([apple-opengl-framework],
+ [AC_HELP_STRING([--with-apple-opengl-framework],
+ [use Apple OpenGL framework (Mac OS X only)])])
+if test "X$with_apple_opengl_framework" = "Xyes"; then
+ AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
+ [Use the Apple OpenGL framework.])
+ GL_LIBS="-framework OpenGL"
+else
+ AC_LANG_PUSH(C)
+
+ AX_LANG_COMPILER_MS
+ if test X$ax_compiler_ms = Xno; then
+ GL_CFLAGS="${PTHREAD_CFLAGS}"
+ GL_LIBS="${PTHREAD_LIBS} -lm"
+ fi
+
+ #
+ # Use x_includes and x_libraries if they have been set (presumably by
+ # AC_PATH_X).
+ #
+ if test "X$no_x" != "Xyes"; then
+ if test -n "$x_includes"; then
+ GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}"
+ fi
+ if test -n "$x_libraries"; then
+ GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}"
+ fi
+ fi
+
+ AC_CHECK_HEADERS([windows.h])
+
+ AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],
+ [ax_cv_check_gl_libgl="no"
+ ax_save_CPPFLAGS="${CPPFLAGS}"
+ CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
+ ax_save_LIBS="${LIBS}"
+ LIBS=""
+ ax_check_libs="-lopengl32 -lGL"
+ for ax_lib in ${ax_check_libs}; do
+ if test X$ax_compiler_ms = Xyes; then
+ ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
+ else
+ ax_try_lib="${ax_lib}"
+ fi
+ LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[
+# if HAVE_WINDOWS_H && defined(_WIN32)
+# include <windows.h>
+# endif
+# include <GL/gl.h>]],
+ [[glBegin(0)]])],
+ [ax_cv_check_gl_libgl="${ax_try_lib}"; break])
+ done
+ LIBS=${ax_save_LIBS}
+ CPPFLAGS=${ax_save_CPPFLAGS}])
+
+ if test "X${ax_cv_check_gl_libgl}" = "Xno"; then
+ no_gl="yes"
+ GL_CFLAGS=""
+ GL_LIBS=""
+ else
+ GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}"
+ fi
+ AC_LANG_POP(C)
+fi
+
+AC_SUBST([GL_CFLAGS])
+AC_SUBST([GL_LIBS])
+])dnl
+
+dnl ---------------------------------------------------------------------------
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/ax_check_glu.html
+dnl ---------------------------------------------------------------------------
+
+dnl @synopsis AX_CHECK_GLU
+dnl
+dnl Check for GLU. If GLU is found, the required preprocessor and
+dnl linker flags are included in the output variables "GLU_CFLAGS" and
+dnl "GLU_LIBS", respectively. This macro adds the configure option
+dnl "--with-apple-opengl-framework", which users can use to indicate
+dnl that Apple's OpenGL framework should be used on Mac OS X. If
+dnl Apple's OpenGL framework is used, the symbol
+dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GLU implementation
+dnl is found, "no_glu" is set to "yes".
+dnl
+dnl @category InstalledPackages
+dnl @author Braden McDaniel <braden@endoframe.com>
+dnl @version 2004-11-15
+dnl @license AllPermissive
+
+AC_DEFUN([AX_CHECK_GLU],
+[AC_REQUIRE([AX_CHECK_GL])dnl
+AC_REQUIRE([AC_PROG_CXX])dnl
+GLU_CFLAGS="${GL_CFLAGS}"
+if test "X${with_apple_opengl_framework}" != "Xyes"; then
+ AC_CACHE_CHECK([for OpenGL Utility library], [ax_cv_check_glu_libglu],
+ [ax_cv_check_glu_libglu="no"
+ ax_save_CPPFLAGS="${CPPFLAGS}"
+ CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
+ ax_save_LIBS="${LIBS}"
+ LIBS=""
+ ax_check_libs="-lglu32 -lGLU"
+ for ax_lib in ${ax_check_libs}; do
+ if test X$ax_compiler_ms = Xyes; then
+ ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
+ else
+ ax_try_lib="${ax_lib}"
+ fi
+ LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
+ #
+ # libGLU typically links with libstdc++ on POSIX platforms. However,
+ # setting the language to C++ means that test program source is named
+ # "conftest.cc"; and Microsoft cl doesn't know what to do with such a
+ # file.
+ #
+ AC_LANG_PUSH([C++])
+ if test X$ax_compiler_ms = Xyes; then
+ AC_LANG_PUSH([C])
+ fi
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[
+# if HAVE_WINDOWS_H && defined(_WIN32)
+# include <windows.h>
+# endif
+# include <GL/glu.h>]],
+ [[gluBeginCurve(0)]])],
+ [ax_cv_check_glu_libglu="${ax_try_lib}"; break])
+ if test X$ax_compiler_ms = Xyes; then
+ AC_LANG_POP([C])
+ fi
+ AC_LANG_POP([C++])
+ done
+ LIBS=${ax_save_LIBS}
+ CPPFLAGS=${ax_save_CPPFLAGS}])
+ if test "X${ax_cv_check_glu_libglu}" = "Xno"; then
+ no_glu="yes"
+ GLU_CFLAGS=""
+ GLU_LIBS=""
+ else
+ GLU_LIBS="${ax_cv_check_glu_libglu} ${GL_LIBS}"
+ fi
+fi
+AC_SUBST([GLU_CFLAGS])
+AC_SUBST([GLU_LIBS])
+])
+
+dnl ---------------------------------------------------------------------------
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/ax_check_glut.html
+dnl ---------------------------------------------------------------------------
+
+dnl @synopsis AX_CHECK_GLUT
+dnl
+dnl Check for GLUT. If GLUT is found, the required compiler and linker
+dnl flags are included in the output variables "GLUT_CFLAGS" and
+dnl "GLUT_LIBS", respectively. This macro adds the configure option
+dnl "--with-apple-opengl-framework", which users can use to indicate
+dnl that Apple's OpenGL framework should be used on Mac OS X. If
+dnl Apple's OpenGL framework is used, the symbol
+dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If GLUT is not found,
+dnl "no_glut" is set to "yes".
+dnl
+dnl @category InstalledPackages
+dnl @author Braden McDaniel <braden@endoframe.com>
+dnl @version 2004-11-15
+dnl @license AllPermissive
+
+AC_DEFUN([AX_CHECK_GLUT],
+[AC_REQUIRE([AX_CHECK_GLU])dnl
+AC_REQUIRE([AC_PATH_XTRA])dnl
+
+if test "X$with_apple_opengl_framework" = "Xyes"; then
+ GLUT_CFLAGS="${GLU_CFLAGS}"
+ GLUT_LIBS="-framework GLUT -lobjc ${GL_LIBS}"
+else
+ GLUT_CFLAGS=${GLU_CFLAGS}
+ GLUT_LIBS=${GLU_LIBS}
+
+ #
+ # If X is present, assume GLUT depends on it.
+ #
+ if test "X${no_x}" != "Xyes"; then
+ GLUT_LIBS="${X_PRE_LIBS} -lXmu -lXi ${X_EXTRA_LIBS} ${GLUT_LIBS}"
+ fi
+
+ AC_LANG_PUSH(C)
+
+ ax_save_CPPFLAGS="${CPPFLAGS}"
+ CPPFLAGS="${GLUT_CFLAGS} ${CPPFLAGS}"
+
+ AC_CACHE_CHECK([for GLUT library], [ax_cv_check_glut_libglut],
+ [ax_cv_check_glut_libglut="no"
+ ax_save_LIBS="${LIBS}"
+ LIBS=""
+ ax_check_libs="-lglut32 -lglut"
+ for ax_lib in ${ax_check_libs}; do
+ if test X$ax_compiler_ms = Xyes; then
+ ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
+ else
+ ax_try_lib="${ax_lib}"
+ fi
+ LIBS="${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[
+# if HAVE_WINDOWS_H && defined(_WIN32)
+# include <windows.h>
+# endif
+# include <GL/glut.h>]],
+ [[glutMainLoop()]])],
+ [ax_cv_check_glut_libglut="${ax_try_lib}"; break])
+
+ done
+ LIBS=${ax_save_LIBS}
+ ])
+ CPPFLAGS="${ax_save_CPPFLAGS}"
+ AC_LANG_POP(C)
+
+ if test "X${ax_cv_check_glut_libglut}" = "Xno"; then
+ no_glut="yes"
+ GLUT_CFLAGS=""
+ GLUT_LIBS=""
+ else
+ GLUT_LIBS="${ax_cv_check_glut_libglut} ${GLUT_LIBS}"
+ fi
+fi
+
+AC_SUBST([GLUT_CFLAGS])
+AC_SUBST([GLUT_LIBS])
+])dnl
+
+dnl ---------------------------------------------------------------------------
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/acx_pthread.html
+dnl ---------------------------------------------------------------------------
+
+dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+dnl
+dnl This macro figures out how to build C programs using POSIX threads.
+dnl It sets the PTHREAD_LIBS output variable to the threads library and
+dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
+dnl C compiler flags that are needed. (The user can also force certain
+dnl compiler flags/libs to be tested by setting these environment
+dnl variables.)
+dnl
+dnl Also sets PTHREAD_CC to any special C compiler that is needed for
+dnl multi-threaded programs (defaults to the value of CC otherwise).
+dnl (This is necessary on AIX to use the special cc_r compiler alias.)
+dnl
+dnl NOTE: You are assumed to not only compile your program with these
+dnl flags, but also link it with them as well. e.g. you should link
+dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
+dnl $LIBS
+dnl
+dnl If you are only building threads programs, you may wish to use
+dnl these variables in your default LIBS, CFLAGS, and CC:
+dnl
+dnl LIBS="$PTHREAD_LIBS $LIBS"
+dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+dnl CC="$PTHREAD_CC"
+dnl
+dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
+dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
+dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+dnl
+dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
+dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
+dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
+dnl default action will define HAVE_PTHREAD.
+dnl
+dnl Please let the authors know if this macro fails on any platform, or
+dnl if you have any other suggestions or comments. This macro was based
+dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
+dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
+dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
+dnl We are also grateful for the helpful feedback of numerous users.
+dnl
+dnl @category InstalledPackages
+dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
+dnl @version 2005-01-14
+dnl @license GPLWithACException
+
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+ AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+ AC_MSG_RESULT($acx_pthread_ok)
+ if test x"$acx_pthread_ok" = xno; then
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+ fi
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try. Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important. Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+# other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+# doesn't hurt to check since this sometimes defines pthreads too;
+# also defines -D_REENTRANT)
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+ *solaris*)
+
+ # On Solaris (at least, for some versions), libc contains stubbed
+ # (non-functional) versions of the pthreads routines, so link-based
+ # tests will erroneously succeed. (We need to link with -pthread or
+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
+ # a function called by this macro, so we could check for that, but
+ # who knows whether they'll stub that too in a future libc.) So,
+ # we'll just look for -pthreads and -lpthread first:
+
+ acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
+ ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+ case $flag in
+ none)
+ AC_MSG_CHECKING([whether pthreads work without any flags])
+ ;;
+
+ -*)
+ AC_MSG_CHECKING([whether pthreads work with $flag])
+ PTHREAD_CFLAGS="$flag"
+ ;;
+
+ pthread-config)
+ AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+ if test x"$acx_pthread_config" = xno; then continue; fi
+ PTHREAD_CFLAGS="`pthread-config --cflags`"
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+ ;;
+
+ *)
+ AC_MSG_CHECKING([for the pthreads library -l$flag])
+ PTHREAD_LIBS="-l$flag"
+ ;;
+ esac
+
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Check for various functions. We must include pthread.h,
+ # since some functions may be macros. (On the Sequent, we
+ # need a special flag -Kthread to make this header compile.)
+ # We check for pthread_join because it is in -lpthread on IRIX
+ # while pthread_create is in libc. We check for pthread_attr_init
+ # due to DEC craziness with -lpthreads. We check for
+ # pthread_cleanup_push because it is one of the few pthread
+ # functions on Solaris that doesn't have a non-functional libc stub.
+ # We try pthread_create on general principles.
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [acx_pthread_ok=yes])
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ AC_MSG_RESULT($acx_pthread_ok)
+ if test "x$acx_pthread_ok" = xyes; then
+ break;
+ fi
+
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+ AC_MSG_CHECKING([for joinable pthread attribute])
+ attr_name=unknown
+ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+ AC_TRY_LINK([#include <pthread.h>], [int attr=$attr;],
+ [attr_name=$attr; break])
+ done
+ AC_MSG_RESULT($attr_name)
+ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+ AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+ [Define to necessary symbol if this constant
+ uses a non-standard name on your system.])
+ fi
+
+ AC_MSG_CHECKING([if more special flags are required for pthreads])
+ flag=no
+ case "${host_cpu}-${host_os}" in
+ *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+ *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+ esac
+ AC_MSG_RESULT(${flag})
+ if test "x$flag" != xno; then
+ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+ fi
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ # More AIX lossage: must compile with cc_r
+ AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
+else
+ PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+ ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+ :
+else
+ acx_pthread_ok=no
+ $2
+fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/aclocal.m4
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/config
Name: svn:ignore
+ config.guess
config.sub
ltmain.sh
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/config/config.guess
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/config/config.sub
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/config/ltmain.sh
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/config/mkinstalldirs (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/config/mkinstalldirs 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/config/mkinstalldirs 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1,7 +1,7 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
-scriptversion=2004-02-15.20
+scriptversion=2005-06-29.22
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
@@ -12,7 +12,7 @@
# <automake-patches@gnu.org>.
errstatus=0
-dirmode=""
+dirmode=
usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
@@ -27,7 +27,7 @@
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
- exit 0
+ exit $?
;;
-m) # -m PERM arg
shift
@@ -37,7 +37,7 @@
;;
--version)
echo "$0 $scriptversion"
- exit 0
+ exit $?
;;
--) # stop option processing
shift
@@ -103,13 +103,21 @@
for file
do
- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ case $file in
+ /*) pathcomp=/ ;;
+ *) pathcomp= ;;
+ esac
+ oIFS=$IFS
+ IFS=/
+ set fnord $file
shift
+ IFS=$oIFS
- pathcomp=
for d
do
- pathcomp="$pathcomp$d"
+ test "x$d" = x && continue
+
+ pathcomp=$pathcomp$d
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
@@ -124,7 +132,7 @@
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
- lasterr=""
+ lasterr=
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
@@ -134,7 +142,7 @@
fi
fi
- pathcomp="$pathcomp/"
+ pathcomp=$pathcomp/
done
done
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/configure
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/acorn
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/acorn/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/addtiffo
Name: svn:ignore
- .deps
Makefile
+ .deps
Makefile
addtiffo
Makefile.in
.libs
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/addtiffo/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/dbs
Name: svn:ignore
- .deps
Makefile
+ .deps
Makefile
tiff-bi
Makefile.in
tiff-palette
tiff-rgb
tiff-grayscale
.libs
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/dbs/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/dbs/xtiff
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/dbs/xtiff/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/iptcutil
Name: svn:ignore
- .deps
Makefile
+ .deps
Makefile
Makefile.in
.libs
iptcutil
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/iptcutil/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/mac-cw
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/mac-cw/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/mac-mpw
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/mac-mpw/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/mfs
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/mfs/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/ojpeg
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/ojpeg/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/pds
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/pds/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/ras
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/ras/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/stream
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/stream/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/tags
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/tags/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/win_dib
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/contrib/win_dib/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/html
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/html/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/html/images
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/html/images/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/html/man
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/html/man/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/libtiff
Name: svn:ignore
- tif_config.h
tiffconf.h
.deps
Makefile
stamp-h1
stamp-h2
+ tif_config.h
tiffconf.h
.deps
Makefile
stamp-h1
stamp-h2
Makefile.in
tif_config.h.in
.libs
mkg3states
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/libtiff/Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/libtiff/tif_config.h.in
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/libtiff/tif_fax3.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/libtiff/tif_fax3.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/libtiff/tif_fax3.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -85,6 +85,8 @@
unsigned char* refline; /* reference line for 2d decoding */
int k; /* #rows left that can be 2d encoded */
int maxk; /* max #rows that can be 2d encoded */
+
+ int line;
} Fax3CodecState;
#define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
#define EncoderState(tif) ((Fax3CodecState*) Fax3State(tif))
@@ -167,6 +169,7 @@
sp->refruns[0] = (uint32) sp->b.rowpixels;
sp->refruns[1] = 0;
}
+ sp->line = 0;
return (1);
}
@@ -184,7 +187,7 @@
(unsigned long) (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
(unsigned long) a0);
}
-#define unexpected(table, a0) Fax3Unexpected(module, tif, line, a0)
+#define unexpected(table, a0) Fax3Unexpected(module, tif, sp->line, a0)
static void
Fax3Extension(const char* module, TIFF* tif, uint32 line, uint32 a0)
@@ -195,7 +198,7 @@
(unsigned long) (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
(unsigned long) a0);
}
-#define extension(a0) Fax3Extension(module, tif, line, a0)
+#define extension(a0) Fax3Extension(module, tif, sp->line, a0)
static void
Fax3BadLength(const char* module, TIFF* tif, uint32 line, uint32 a0, uint32 lastx)
@@ -207,7 +210,7 @@
(unsigned long) (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
(unsigned long) a0, lastx);
}
-#define badlength(a0,lastx) Fax3BadLength(module, tif, line, a0, lastx)
+#define badlength(a0,lastx) Fax3BadLength(module, tif, sp->line, a0, lastx)
static void
Fax3PrematureEOF(const char* module, TIFF* tif, uint32 line, uint32 a0)
@@ -218,7 +221,7 @@
(unsigned long) (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
(unsigned long) a0);
}
-#define prematureEOF(a0) Fax3PrematureEOF(module, tif, line, a0)
+#define prematureEOF(a0) Fax3PrematureEOF(module, tif, sp->line, a0)
#define Nop
@@ -229,7 +232,6 @@
Fax3Decode1D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
{
DECLARE_STATE(tif, sp, "Fax3Decode1D");
- int line = 0;
(void) s;
CACHE_STATE(tif, sp);
@@ -248,7 +250,7 @@
(*sp->fill)(buf, thisrun, pa, lastx);
buf += sp->b.rowbytes;
occ -= sp->b.rowbytes;
- line++;
+ sp->line++;
continue;
EOF1D: /* premature EOF */
CLEANUP_RUNS();
@@ -269,7 +271,6 @@
Fax3Decode2D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
{
DECLARE_STATE_2D(tif, sp, "Fax3Decode2D");
- int line = 0;
int is1D; /* current line is 1d/2d-encoded */
(void) s;
@@ -302,7 +303,7 @@
SWAP(uint32*, sp->curruns, sp->refruns);
buf += sp->b.rowbytes;
occ -= sp->b.rowbytes;
- line++;
+ sp->line++;
continue;
EOF2D: /* premature EOF */
CLEANUP_RUNS();
@@ -492,14 +493,14 @@
);
nruns = needsRefLine ? 2*TIFFroundup(rowpixels,32) : rowpixels;
-
- dsp->runs = (uint32*) _TIFFCheckMalloc(tif, 2*nruns+3, sizeof (uint32),
+ nruns += 3;
+ dsp->runs = (uint32*) _TIFFCheckMalloc(tif, 2*nruns, sizeof (uint32),
"for Group 3/4 run arrays");
if (dsp->runs == NULL)
return (0);
dsp->curruns = dsp->runs;
if (needsRefLine)
- dsp->refruns = dsp->runs + (nruns>>1);
+ dsp->refruns = dsp->runs + nruns;
else
dsp->refruns = NULL;
if (td->td_compression == COMPRESSION_CCITTFAX3
@@ -718,6 +719,7 @@
sp->k = sp->maxk-1;
} else
sp->k = sp->maxk = 0;
+ sp->line = 0;
return (1);
}
@@ -1378,7 +1380,6 @@
Fax4Decode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
{
DECLARE_STATE_2D(tif, sp, "Fax4Decode");
- int line = 0;
(void) s;
CACHE_STATE(tif, sp);
@@ -1401,7 +1402,7 @@
SWAP(uint32*, sp->curruns, sp->refruns);
buf += sp->b.rowbytes;
occ -= sp->b.rowbytes;
- line++;
+ sp->line++;
continue;
EOFG4:
NeedBits16( 13, BADG4 );
@@ -1487,7 +1488,6 @@
{
DECLARE_STATE(tif, sp, "Fax3DecodeRLE");
int mode = sp->b.mode;
- int line = 0;
(void) s;
CACHE_STATE(tif, sp);
@@ -1517,7 +1517,7 @@
}
buf += sp->b.rowbytes;
occ -= sp->b.rowbytes;
- line++;
+ sp->line++;
continue;
EOFRLE: /* premature EOF */
(*sp->fill)(buf, thisrun, pa, lastx);
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/m4/acinclude.m4
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/m4/libtool.m4
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/m4/ltoptions.m4
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/m4/ltsugar.m4
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/m4/ltversion.m4
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/man
Name: svn:ignore
- Makefile
+ Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/man/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/port
Name: svn:ignore
- .deps
Makefile
+ .deps
Makefile
Makefile.in
.libs
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/port/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/test
Name: svn:ignore
- .deps
Makefile
+ .deps
Makefile
Makefile.in
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/test/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/tools
Name: svn:ignore
- .deps
Makefile
+ .deps
Makefile
ras2tiff
Makefile.in
raw2tiff
tiffdither
fax2ps
tiffsplit
bmp2tiff
fax2tiff
tiffcp
tiff2ps
tiffcmp
gif2tiff
tiffset
tiffdump
thumbnail
ppm2tiff
tiff2bw
tiff2pdf
tiff2rgba
tiffmedian
.libs
rgb2ycbcr
pal2rgb
tiffinfo
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/tiff-3.8.2/tools/Makefile.in
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/unimrcp/plugins/mrcp-flite
Name: svn:ignore
+ Makefile.in
.deps
Makefile
Property changes: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/unimrcp/plugins/mrcp-pocketsphinx
Name: svn:ignore
+ Makefile.in
.deps
Makefile
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/libs/win32/Download TIFF.2008.vcproj
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/patches/mod_portaudio_snow_leopard.diff (from rev 15313, freeswitch/trunk/patches/mod_portaudio_snow_leopard.diff) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/patches/mod_portaudio_snow_leopard.diff (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/patches/mod_portaudio_snow_leopard.diff 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,170 @@
+Index: libs/portaudio/src/hostapi/coreaudio/pa_mac_core.c
+===================================================================
+--- libs/portaudio/src/hostapi/coreaudio/pa_mac_core.c (revision 14988)
++++ libs/portaudio/src/hostapi/coreaudio/pa_mac_core.c (working copy)
+@@ -801,8 +801,8 @@
+ const double sampleRate,
+ void *refCon )
+ {
+- ComponentDescription desc;
+- Component comp;
++ AudioComponentDescription desc;
++ AudioComponent comp;
+ /*An Apple TN suggests using CAStreamBasicDescription, but that is C++*/
+ AudioStreamBasicDescription desiredFormat;
+ OSStatus result = noErr;
+@@ -873,7 +873,7 @@
+ desc.componentFlags = 0;
+ desc.componentFlagsMask = 0;
+ /* -- find the component -- */
+- comp = FindNextComponent( NULL, &desc );
++ comp = AudioComponentFindNext( NULL, &desc );
+ if( !comp )
+ {
+ DBUG( ( "AUHAL component not found." ) );
+@@ -882,7 +882,7 @@
+ return paUnanticipatedHostError;
+ }
+ /* -- open it -- */
+- result = OpenAComponent( comp, audioUnit );
++ result = AudioComponentInstanceNew( comp, audioUnit );
+ if( result )
+ {
+ DBUG( ( "Failed to open AUHAL component." ) );
+@@ -1224,7 +1224,7 @@
+ #undef ERR_WRAP
+
+ error:
+- CloseComponent( *audioUnit );
++ AudioComponentInstanceDispose( *audioUnit );
+ *audioUnit = NULL;
+ if( result )
+ return PaMacCore_SetError( result, line, 1 );
+@@ -2146,13 +2146,13 @@
+ xrunCallback );
+ if( stream->outputUnit && stream->outputUnit != stream->inputUnit ) {
+ AudioUnitUninitialize( stream->outputUnit );
+- CloseComponent( stream->outputUnit );
++ AudioComponentInstanceDispose( stream->outputUnit );
+ }
+ stream->outputUnit = NULL;
+ if( stream->inputUnit )
+ {
+ AudioUnitUninitialize( stream->inputUnit );
+- CloseComponent( stream->inputUnit );
++ AudioComponentInstanceDispose( stream->inputUnit );
+ stream->inputUnit = NULL;
+ }
+ if( stream->inputRingBuffer.buffer )
+@@ -2211,12 +2211,12 @@
+
+ // it's not clear from appl's docs that this really waits
+ // until all data is flushed.
+-static ComponentResult BlockWhileAudioUnitIsRunning( AudioUnit audioUnit, AudioUnitElement element )
++static OSStatus BlockWhileAudioUnitIsRunning( AudioUnit audioUnit, AudioUnitElement element )
+ {
+ Boolean isRunning = 1;
+ while( isRunning ) {
+ UInt32 s = sizeof( isRunning );
+- ComponentResult err = AudioUnitGetProperty( audioUnit, kAudioOutputUnitProperty_IsRunning, kAudioUnitScope_Global, element, &isRunning, &s );
++ OSStatus err = AudioUnitGetProperty( audioUnit, kAudioOutputUnitProperty_IsRunning, kAudioUnitScope_Global, element, &isRunning, &s );
+ if( err )
+ return err;
+ Pa_Sleep( 100 );
+Index: libs/portaudio/src/common/pa_types.h
+===================================================================
+--- libs/portaudio/src/common/pa_types.h (revision 14988)
++++ libs/portaudio/src/common/pa_types.h (working copy)
+@@ -62,7 +62,11 @@
+ #endif
+
+ #ifndef SIZEOF_LONG
++#ifdef __LP64__
++#define SIZEOF_LONG 8
++#else
+ #define SIZEOF_LONG 4
++#endif /* __LP64__ */
+ #endif
+
+
+Index: libs/libsndfile/M4/ltsugar.m4
+===================================================================
+--- libs/libsndfile/M4/ltsugar.m4 (revision 14988)
++++ libs/libsndfile/M4/ltsugar.m4 (working copy)
+@@ -1,13 +1,13 @@
+ # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
+ #
+-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+-# Written by Gary V. Vaughan, 2004
++# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
++# Written by Gary V. Vaughan, 2004
+ #
+ # This file is free software; the Free Software Foundation gives
+ # unlimited permission to copy and/or distribute it, with or without
+ # modifications, as long as this notice is preserved.
+
+-# serial 6 ltsugar.m4
++# serial 5 ltsugar.m4
+
+ # This is to help aclocal find these macros, as it can't see m4_define.
+ AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+@@ -63,14 +63,14 @@
+ # Produce a SEP delimited list of all paired combinations of elements of
+ # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
+ # has the form PREFIXmINFIXSUFFIXn.
+-# Needed until we can rely on m4_combine added in Autoconf 2.62.
+ m4_define([lt_combine],
+-[m4_if(m4_eval([$# > 3]), [1],
+- [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+-[[m4_foreach([_Lt_prefix], [$2],
+- [m4_foreach([_Lt_suffix],
+- ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+- [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
++[m4_if([$2], [], [],
++ [m4_if([$4], [], [],
++ [lt_join(m4_quote(m4_default([$1], [[, ]])),
++ lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2],
++ [m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]),
++ [_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl
++])
+
+
+ # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+Index: libs/libsndfile/M4/ltversion.m4
+===================================================================
+--- libs/libsndfile/M4/ltversion.m4 (revision 14988)
++++ libs/libsndfile/M4/ltversion.m4 (working copy)
+@@ -9,15 +9,15 @@
+
+ # Generated from ltversion.in.
+
+-# serial 3012 ltversion.m4
++# serial 2976 ltversion.m4
+ # This file is part of GNU Libtool
+
+-m4_define([LT_PACKAGE_VERSION], [2.2.6])
+-m4_define([LT_PACKAGE_REVISION], [1.3012])
++m4_define([LT_PACKAGE_VERSION], [2.2.4])
++m4_define([LT_PACKAGE_REVISION], [1.2976])
+
+ AC_DEFUN([LTVERSION_VERSION],
+-[macro_version='2.2.6'
+-macro_revision='1.3012'
++[macro_version='2.2.4'
++macro_revision='1.2976'
+ _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+ _LT_DECL(, macro_revision, 0)
+ ])
+Index: libs/libsndfile/M4/ltoptions.m4
+===================================================================
+--- libs/libsndfile/M4/ltoptions.m4 (revision 14988)
++++ libs/libsndfile/M4/ltoptions.m4 (working copy)
+@@ -125,7 +125,7 @@
+ [enable_win32_dll=yes
+
+ case $host in
+-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
++*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/scripts/perl/wplookup.cgi (from rev 15313, freeswitch/trunk/scripts/perl/wplookup.cgi) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/scripts/perl/wplookup.cgi (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/scripts/perl/wplookup.cgi 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+#
+# see http://developer.whitepages.com/ for details
+#
+
+use Data::Dumper;
+use Net::WhitePages;
+use CGI qw/:standard/;
+
+my $wp = Net::WhitePages->new(TOKEN => "API_TOKEN");
+
+
+$caller_id = param('caller_id');
+
+print header("text/plain");
+my $res = $wp->reverse_phone(phone => $caller_id);
+foreach $entry (@{$res->{listings}}) {
+ if($entry->{business}) {
+ print uc("$entry->{business}->{businessname}");
+ } elsif ($entry->{displayname}) {
+ print uc("$entry->{displayname}");
+ } else {
+ print uc("$entry->{address}->{city}, $entry->{address}->{state}");
+ }
+ last;
+};
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_buffer.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_buffer.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_buffer.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -137,6 +137,8 @@
*/
SWITCH_DECLARE(void) switch_buffer_zero(_In_ switch_buffer_t *buffer);
+SWITCH_DECLARE(switch_size_t) switch_buffer_slide_write(switch_buffer_t *buffer, const void *data, switch_size_t datalen);
+
/*! \brief Destroy the buffer
* \param buffer buffer to destroy
* \note only neccessary on dynamic buffers (noop on pooled ones)
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_caller.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_caller.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_caller.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -67,6 +67,10 @@
const char *caller_id_name;
/*! Caller ID Number */
const char *caller_id_number;
+ /*! Callee ID Name */
+ const char *callee_id_name;
+ /*! Callee ID Number */
+ const char *callee_id_number;
uint8_t caller_ton;
uint8_t caller_numplan;
/*! Caller Network Address (when applicable) */
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_channel.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_channel.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_channel.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -80,6 +80,7 @@
#define switch_channel_media_ready(_channel) switch_channel_test_ready(_channel, 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);
@@ -228,6 +229,8 @@
\returns SWITCH_STATUS_SUCCESS if successful
*/
+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,
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, ...);
@@ -249,6 +252,8 @@
SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname);
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);
+
/*!
* \brief Start iterating over the entries in the channel variable list.
* \param channel the channel to iterate the variables for
@@ -262,6 +267,11 @@
*/
SWITCH_DECLARE(void) switch_channel_variable_last(switch_channel_t *channel);
+
+SWITCH_DECLARE(void) switch_channel_restart(switch_channel_t *channel);
+
+SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switch_channel_t *orig_channel, switch_channel_t *new_channel, uint32_t offset);
+
/*!
\brief Assign a caller extension to a given channel
\param channel channel to assign extension to
@@ -292,6 +302,10 @@
SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel_t *channel, switch_channel_flag_t flag);
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_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);
+
/*!
\brief Set given flag(s) on a given channel's bridge partner
\param channel channel to derive the partner channel to set flag on
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_core.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_core.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_core.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -59,6 +59,9 @@
struct switch_app_log *next;
};
+#define MESSAGE_STAMP_FFL(_m) _m->_file = __FILE__; _m->_func = __SWITCH_FUNC__; _m->_line = __LINE__
+
+#define MESSAGE_STRING_ARG_MAX 10
/*! \brief A message object designed to allow unlike technologies to exchange data */
struct switch_core_session_message {
/*! uuid of the sender (for replies) */
@@ -92,7 +95,8 @@
const char *_file;
const char *_func;
int _line;
-
+ const char *string_array_arg[MESSAGE_STRING_ARG_MAX];
+ time_t delivery_time;
};
/*! \brief A generic object to pass as a thread's session object to allow mutiple arguements and a pool */
@@ -634,6 +638,7 @@
/*!
\brief Signal a session's state machine thread that a state change has occured
*/
+SWITCH_DECLARE(void) switch_core_session_wake_session_thread(_In_ switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_session_signal_state_change(_In_ switch_core_session_t *session);
/*!
@@ -653,6 +658,10 @@
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_locate(const char *uuid_str, const char *file, const char *func, int line);
#endif
+#ifdef SWITCH_DEBUG_RWLOCKS
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_force_locate(const char *uuid_str, const char *file, const char *func, int line);
+#endif
+
/*!
\brief Locate a session based on it's uuid
\param uuid_str the unique id of the session you want to find
@@ -737,6 +746,8 @@
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(_In_ switch_core_session_t *session, _In_ switch_core_session_message_t *message);
+SWITCH_DECLARE(void) switch_core_session_free_message(switch_core_session_message_t **message);
+
/*!
\brief pass an indication message on a session
\param session the session to pass the message across
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_cpp.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_cpp.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_cpp.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -20,19 +20,8 @@
tts_name = NULL; \
voice_name = NULL; \
xml_cdr_text = NULL; \
- memset(&caller_profile, 0, sizeof(caller_profile)); \
memset(&args, 0, sizeof(args)); \
ap = NULL; \
- caller_profile.source = "mod_unknown"; \
- caller_profile.dialplan = ""; \
- caller_profile.context = ""; \
- caller_profile.caller_id_name = ""; \
- caller_profile.caller_id_number = ""; \
- caller_profile.network_addr = ""; \
- caller_profile.ani = ""; \
- caller_profile.aniii = ""; \
- caller_profile.rdnis = ""; \
- caller_profile.username = ""; \
flags = 0; \
on_hangup = NULL; \
memset(&cb_state, 0, sizeof(cb_state)); \
@@ -199,7 +188,6 @@
switch_input_args_t args; // holds ptr to cb function and input_callback_state struct
// which has a language specific callback function
switch_input_args_t *ap; // ptr to args .. (is this really needed?)
- switch_caller_profile_t caller_profile; // avoid passing so many args to originate,
// instead set them here first
char *xml_cdr_text;
void store_file_handle(switch_file_handle_t *fh);
@@ -247,12 +235,10 @@
*/
SWITCH_DECLARE(int) recordFile(char *file_name, int time_limit = 0, int silence_threshold = 0, int silence_hits = 0);
-
/** \brief Set attributes of caller data for purposes of outgoing calls
* \param var - the variable name, eg, "caller_id_name"
* \param val - the data to set, eg, "bob"
*/
- SWITCH_DECLARE(void) setCallerData(char *var, char *val);
/** \brief Originate a call to a destination
*
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_ivr.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_ivr.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_ivr.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -102,6 +102,7 @@
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_events(switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_ivr_parse_next_event(switch_core_session_t *session);
+SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_messages(switch_core_session_t *session);
/*!
\brief Wait for time to pass for a specified number of milliseconds
@@ -408,6 +409,8 @@
switch_originate_flag_t flags
);
+SWITCH_DECLARE(void) switch_ivr_bridge_display(switch_core_session_t *session, switch_core_session_t *peer_session);
+
/*!
\brief Bridge Audio from one session to another
\param session one session
@@ -800,6 +803,8 @@
SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data);
SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname);
+SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid);
+
/** @} */
SWITCH_END_EXTERN_C
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_loadable_module.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_loadable_module.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_loadable_module.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -335,7 +335,7 @@
if (ptime < 120) return 1;
break;
case 48000:
- max_ms = 20;
+ max_ms = 40;
ptime_div = 2;
break;
case 32000:
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_types.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_types.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_types.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -111,6 +111,7 @@
#define SWITCH_PATH_SEPARATOR "/"
#endif
#define SWITCH_URL_SEPARATOR "://"
+#define SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE "ignore_display_updates"
#define SWITCH_AUDIO_SPOOL_PATH_VARIABLE "audio_spool_path"
#define SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE "bridge_hangup_cause"
#define SWITCH_READ_TERMINATOR_USED_VARIABLE "read_terminator_used"
@@ -125,9 +126,13 @@
#define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application"
#define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause"
#define SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE "execute_on_answer"
+#define SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE "execute_on_pre_answer"
+#define SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE "execute_on_media"
+#define SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE "api_on_answer"
#define SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE "execute_on_ring"
#define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout"
#define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid"
+#define SWITCH_SOFT_HOLDING_UUID_VARIABLE "soft_holding_uuid"
#define SWITCH_API_BRIDGE_END_VARIABLE "api_after_bridge"
#define SWITCH_API_HANGUP_HOOK_VARIABLE "api_hangup_hook"
#define SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE "session_in_hangup_hook"
@@ -508,7 +513,9 @@
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_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_enum_t;
typedef uint32_t switch_rtp_flag_t;
@@ -659,6 +666,9 @@
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
} switch_core_session_message_types_t;
@@ -866,10 +876,18 @@
*/
typedef enum {
+ CC_MEDIA_ACK = 1,
+ CC_BYPASS_MEDIA,
+ CC_PROXY_MEDIA,
+ /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
+ CC_FLAG_MAX
+} switch_channel_cap_t;
+
+typedef enum {
CF_ANSWERED = 1,
CF_OUTBOUND,
CF_EARLY_MEDIA,
- CF_ORIGINATOR,
+ CF_BRIDGE_ORIGINATOR,
CF_TRANSFER,
CF_ACCEPT_CNG,
CF_REDIRECT,
@@ -903,6 +921,12 @@
CF_REPORTING,
CF_PARK,
CF_TIMESTAMP_SET,
+ CF_ORIGINATOR,
+ CF_XFER_ZOMBIE,
+ CF_MEDIA_ACK,
+ CF_THREAD_SLEEPING,
+ CF_DISABLE_RINGBACK,
+ CF_NOT_READY,
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
CF_FLAG_MAX
} switch_channel_flag_t;
@@ -1101,7 +1125,7 @@
SMBF_READ_REPLACE = (1 << 3),
SMBF_READ_PING = (1 << 4),
SMBF_STEREO = (1 << 5),
- SMBF_RECORD_ANSWER_REQ = (1 << 6),
+ SMBF_ANSWER_REQ = (1 << 6),
SMBF_THREAD_LOCK = (1 << 7)
} switch_media_bug_flag_enum_t;
typedef uint32_t switch_media_bug_flag_t;
@@ -1287,6 +1311,7 @@
SWITCH_EVENT_NAT,
SWITCH_EVENT_RECORD_START,
SWITCH_EVENT_RECORD_STOP,
+ SWITCH_EVENT_CALL_UPDATE,
SWITCH_EVENT_ALL
} switch_event_types_t;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_utils.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_utils.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/include/switch_utils.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -74,11 +74,11 @@
\param s the string to test
\return true value if the string is NULL or zero length
*/
-#define switch_strlen_zero(s) (!s || *(s) == '\0')
-#define switch_strlen_zero_buf(s) (*(s) == '\0')
+#define zstr(s) (!s || *(s) == '\0')
+#define zstr_buf(s) (*(s) == '\0')
static inline switch_bool_t switch_is_moh(const char *s)
{
- if (switch_strlen_zero(s) || !strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) {
+ if (zstr(s) || !strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) {
return SWITCH_FALSE;
}
return SWITCH_TRUE;
@@ -186,6 +186,9 @@
*/
SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct sockaddr *sa, socklen_t salen);
+SWITCH_DECLARE(int) get_addr_int(switch_sockaddr_t *sa);
+SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2);
+
/*!
\brief get the port number of an ip address
\param sa the struct sockaddr * to get the port from
@@ -355,7 +358,7 @@
char *p;
for (p = s; p && *p; p++) {
uint8_t x = (uint8_t) *p;
- if ((x < 32 || x > 127) && x != '\n' && x != '\r') {
+ if ((x < 32) && x != '\n' && x != '\r') {
*p = ' ';
}
}
@@ -555,7 +558,13 @@
#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);
+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);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_cidlookup/mod_cidlookup.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_cidlookup/mod_cidlookup.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_cidlookup/mod_cidlookup.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -46,6 +46,8 @@
static struct {
char *url;
+
+ char *whitepages_apikey;
switch_bool_t cache;
int cache_expire;
@@ -95,11 +97,11 @@
}
if ((callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) && changed) {
- odbc_dsn = strdup(newvalue);
- if(switch_strlen_zero(odbc_dsn)) {
+ if(zstr(newvalue)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No local database defined.\n");
} else {
+ odbc_dsn = strdup(newvalue);
if ((odbc_user = strchr(odbc_dsn, ':'))) {
*odbc_user++ = '\0';
if ((odbc_pass = strchr(odbc_user, ':'))) {
@@ -145,6 +147,7 @@
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("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_STRING_STRDUP("sql", CONFIG_RELOAD, &globals.sql, "", "sql whre number=${caller_id_number}", "SQL to run if overriding CID"),
@@ -286,9 +289,8 @@
return realsize;
}
-static char *do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, const char *num) {
+static char *do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, const char *query) {
char *name = NULL;
- char *newurl = NULL;
CURL *curl_handle = NULL;
long httpRes = 0;
@@ -298,24 +300,22 @@
memset(&http_data, 0, sizeof(http_data));
- http_data.max_bytes = 1024;
+ http_data.max_bytes = 10240;
SWITCH_STANDARD_STREAM(http_data.stream);
gethostname(hostname, sizeof(hostname));
- newurl = switch_event_expand_headers(event, globals.url);
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "url: %s\n", newurl);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "url: %s\n", query);
curl_handle = curl_easy_init();
- if (!strncasecmp(newurl, "https", 5)) {
+ 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);
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
- curl_easy_setopt(curl_handle, CURLOPT_URL, newurl);
+ curl_easy_setopt(curl_handle, CURLOPT_URL, query);
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, file_callback);
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &http_data);
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-cidlookup/1.0");
@@ -325,19 +325,89 @@
curl_easy_cleanup(curl_handle);
if ( http_data.stream.data &&
- !switch_strlen_zero((char *)http_data.stream.data) &&
+ !zstr((char *)http_data.stream.data) &&
strcmp(" ", http_data.stream.data) ) {
name = switch_core_strdup(pool, http_data.stream.data);
}
- if (newurl != globals.url) {
- switch_safe_free(newurl);
- }
switch_safe_free(http_data.stream.data);
return name;
}
+static char *do_whitepages_lookup(switch_memory_pool_t *pool, switch_event_t *event, const char *num, switch_bool_t *areaonly)
+{
+ char *xml_s = NULL;
+ char *query = NULL;
+ char *name = NULL;
+ char *city = NULL;
+ char *state = NULL;
+ switch_xml_t xml = NULL;
+ switch_xml_t node = NULL;
+
+ /* NANPA check */
+ if (strlen(num) == 11 && num[0] == '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);
+
+ 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;
+ }
+
+ *areaonly = SWITCH_FALSE;
+
+ /* try for bizname first */
+ node = switch_xml_get(xml, "wp:listings", 0, "wp:listing", 0, "wp:business", 0, "wp:businessname", -1);
+ if (node) {
+ name = switch_core_strdup(pool, switch_xml_txt(node));
+ goto done;
+ }
+
+ 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));
+ goto done;
+ }
+
+ node = switch_xml_get(xml, "wp:listings", 0, "wp:listing", 0, "wp:address", 0, "wp:city", -1);
+ if (node) {
+ city = switch_xml_txt(node);
+ }
+
+ node = switch_xml_get(xml, "wp:listings", 0, "wp:listing", 0, "wp:address", 0, "wp:state", -1);
+ if (node) {
+ state = switch_xml_txt(node);
+ }
+
+ if (city || state) {
+ *areaonly = SWITCH_TRUE;
+ name = switch_core_sprintf(pool, "%s %s", city ? city : "", state ? state : "");
+ }
+
+done:
+
+ if (query) {
+ switch_safe_free(query);
+ }
+ if (xml) {
+ switch_xml_free(xml);
+ }
+ 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\n", name ? name : "(null)");
+ return name;
+}
+
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;
@@ -362,6 +432,10 @@
static char *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 *area = NULL;
+ char *url_query = NULL;
+ char *src = NULL;
+ switch_bool_t areaonly = SWITCH_FALSE;
number = string_digitsonly(pool, num);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "caller_id_number", number);
@@ -369,25 +443,55 @@
/* database always wins */
if (switch_odbc_available() && globals.master_odbc && globals.sql) {
name = do_db_lookup(pool, event, number, globals.sql);
+ src = "database";
}
if (!name && globals.url) {
if (globals.cache) {
name = check_cache(pool, number);
+ src = "cache";
}
if (!skipurl && !name) {
- name = do_lookup_url(pool, event, number);
+ name = do_whitepages_lookup(pool, event, number, &areaonly);
+ src = "whitepages";
+ if (areaonly) {
+ if (!skipcitystate) {
+ area = name; /* preserve if we're not skipping city/state */
+ }
+ name = NULL; /* always clear out name */
+ }
if (globals.cache && name) {
set_cache(pool, number, name);
}
}
+ if (!skipurl && !name) {
+ url_query = switch_event_expand_headers(event, globals.url);
+ name = do_lookup_url(pool, event, url_query);
+ src = "url";
+ if (url_query != globals.url) {
+ switch_safe_free(url_query);
+ }
+
+ /* store and use preserved area info */
+ if (!name && area) {
+ src = "whitepages";
+ name = area;
+ }
+ if (globals.cache && name) {
+ set_cache(pool, number, name);
+ }
+ }
}
/* only do the below if it is a nanpa number */
if (!skipcitystate && strlen(number) == 11 && number[0] == '1' &&
!name && switch_odbc_available() && globals.master_odbc && globals.citystate_sql) {
name = do_db_lookup(pool, event, number, globals.citystate_sql);
+ src = "npanxx";
}
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cidlookup source: %s\n", src);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "cidlookup_source", src);
return name;
}
@@ -443,6 +547,9 @@
if (name && channel) {
switch_channel_set_variable(channel, "original_caller_id_name", switch_core_strdup(pool, profile->caller_id_name));
+ if (!zstr(switch_event_get_header(event, "cidlookup_source"))) {
+ switch_channel_set_variable(channel, "cidlookup_source", switch_core_strdup(pool, switch_event_get_header(event, "cidlookup_source")));
+ }
profile->caller_id_name = switch_core_strdup(profile->pool, name);;
}
@@ -470,7 +577,7 @@
switch_bool_t skipurl = SWITCH_FALSE;
switch_bool_t skipcitystate = SWITCH_FALSE;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_commands/mod_commands.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_commands/mod_commands.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_commands/mod_commands.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -45,11 +45,20 @@
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown);
SWITCH_MODULE_DEFINITION(mod_commands, mod_commands_load, mod_commands_shutdown, NULL);
+SWITCH_STANDARD_API(hostname_api_function)
+{
+ char hostname[256]="";
+ gethostname(hostname, sizeof(hostname));
+ stream->write_function(stream, "%s",hostname);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
SWITCH_STANDARD_API(host_lookup_function)
{
char host[256] = "";
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", "parameter missing\n");
} else {
if (switch_resolve_host(cmd, host, sizeof(host)) == SWITCH_STATUS_SUCCESS) {
@@ -146,7 +155,7 @@
int diff;
int max = 10;
char *p;
- if (switch_strlen_zero(cmd)){
+ if (zstr(cmd)){
stream->write_function(stream, "parameter missing\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -189,7 +198,7 @@
char *fp = NULL;
const char *call_delim = ",";
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto end;
}
@@ -224,7 +233,7 @@
domain = switch_core_get_variable("domain");
}
- if (!switch_strlen_zero(domain)) {
+ if (!zstr(domain)) {
switch_xml_t xml, x_domain, x_group;
switch_event_t *params;
switch_stream_handle_t dstream = { 0 };
@@ -377,7 +386,7 @@
const char *rval = "false";
char *group;
- if (switch_strlen_zero(cmd) || !(mydata = strdup(cmd))) {
+ if (zstr(cmd) || !(mydata = strdup(cmd))) {
goto end;
}
@@ -427,7 +436,7 @@
const char *container = "params", *elem = "param";
switch_event_t *params = NULL;
- if (switch_strlen_zero(cmd) || !(mydata = strdup(cmd))) {
+ if (zstr(cmd) || !(mydata = strdup(cmd))) {
goto end;
}
@@ -580,7 +589,7 @@
{
char digest[SWITCH_MD5_DIGEST_STRING_SIZE] = { 0 };
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", "!err!");
} else {
switch_md5_string(digest, (void *) cmd, strlen(cmd));
@@ -595,7 +604,7 @@
char *reply = "";
char *data = NULL;
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
data = strdup(cmd);
switch_url_decode(data);
reply = data;
@@ -627,7 +636,7 @@
ip = ip_buf;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", "-STUN Failed! NO STUN SERVER\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -658,7 +667,7 @@
switch_core_new_memory_pool(&pool);
- if (switch_strlen_zero(stun_ip)) {
+ if (zstr(stun_ip)) {
stream->write_function(stream, "%s", "-STUN Failed! NO STUN SERVER\n");
} else {
if ((switch_stun_lookup(&ip, &port, stun_ip, stun_port, &error, pool)) == SWITCH_STATUS_SUCCESS && ip && port) {
@@ -684,7 +693,7 @@
switch_core_session_t *xsession;
char uuid[80] = "";
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-ERR, no input\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -699,7 +708,7 @@
}
}
- if (switch_strlen_zero(mycmd)) {
+ if (zstr(mycmd)) {
stream->write_function(stream, "-ERR, no input\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -739,7 +748,7 @@
char uuid[80] = "";
const char *p, *input = cmd;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", "");
return SWITCH_STATUS_SUCCESS;
}
@@ -751,7 +760,7 @@
}
}
- if (switch_strlen_zero(input)) {
+ if (zstr(input)) {
stream->write_function(stream, "%s", "");
return SWITCH_STATUS_SUCCESS;
}
@@ -778,7 +787,7 @@
SWITCH_STANDARD_API(module_exists_function)
{
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
if (switch_loadable_module_exists(cmd) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "true");
} else {
@@ -793,7 +802,7 @@
{
switch_xml_t root = NULL, domain = NULL;
- if (!switch_strlen_zero(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);
@@ -811,7 +820,7 @@
char *data = NULL;
int len = 0 ;
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
len = (strlen(cmd) * 3) + 1;
switch_zmalloc(data, len);
switch_url_encode(cmd, data, len);
@@ -1249,7 +1258,7 @@
char *mydata, *argv[5];
int32_t arg = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", CTL_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1374,7 +1383,7 @@
{
const char *err;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", LOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1395,7 +1404,7 @@
switch_bool_t force = SWITCH_FALSE;
const char *p = cmd;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1419,7 +1428,7 @@
}
end:
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1439,7 +1448,7 @@
switch_bool_t force = SWITCH_FALSE;
const char *p = cmd;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1462,7 +1471,7 @@
}
end:
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1504,7 +1513,7 @@
char *mycmd = NULL, *kcause = NULL;
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
- if (switch_strlen_zero(cmd) || !(mycmd = strdup(cmd))) {
+ if (zstr(cmd) || !(mycmd = strdup(cmd))) {
stream->write_function(stream, "-USAGE: %s\n", KILL_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1513,11 +1522,11 @@
*kcause++ = '\0';
}
- if (switch_strlen_zero(mycmd) || !(ksession = switch_core_session_locate(mycmd))) {
+ if (zstr(mycmd) || !(ksession = switch_core_session_locate(mycmd))) {
stream->write_function(stream, "-ERR No Such Channel!\n");
} else {
switch_channel_t *channel = switch_core_session_get_channel(ksession);
- if (!switch_strlen_zero(kcause)){
+ if (!zstr(kcause)){
cause = switch_channel_str2cause(kcause);
}
switch_channel_hangup(channel, cause);
@@ -1536,7 +1545,7 @@
char *mycmd = NULL, *argv[3] = { 0 };
int argc = 0;
- if (switch_strlen_zero(cmd) || !(mycmd = strdup(cmd))) {
+ if (zstr(cmd) || !(mycmd = strdup(cmd))) {
goto usage;
}
@@ -1590,7 +1599,7 @@
int argc = 0;
char *tuuid, *dest, *dp, *context, *arg = NULL;
- if (switch_strlen_zero(cmd) || !(mycmd = strdup(cmd))) {
+ if (zstr(cmd) || !(mycmd = strdup(cmd))) {
stream->write_function(stream, "-USAGE: %s\n", TRANSFER_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1606,7 +1615,7 @@
dp = argv[2];
context = argv[3];
- if (switch_strlen_zero(tuuid) || !(tsession = switch_core_session_locate(tuuid))) {
+ if (zstr(tuuid) || !(tsession = switch_core_session_locate(tuuid))) {
stream->write_function(stream, "-ERR No Such Channel!\n");
goto done;
}
@@ -1734,13 +1743,13 @@
switch_core_session_t *tsession = NULL;
char *uuid = NULL, *text = NULL;
- if (!switch_strlen_zero(cmd) && (uuid = strdup(cmd))) {
+ if (!zstr(cmd) && (uuid = strdup(cmd))) {
if ((text = strchr(uuid, ' '))) {
*text++ = '\0';
}
}
- if (switch_strlen_zero(uuid) || switch_strlen_zero(text)) {
+ if (zstr(uuid) || zstr(text)) {
stream->write_function(stream, "-USAGE: %s\n", UUID_CHAT_SYNTAX);
} else {
if ((tsession = switch_core_session_locate(uuid))) {
@@ -1772,13 +1781,13 @@
switch_core_session_t *tsession = NULL;
char *uuid = NULL, *text = NULL;
- if (!switch_strlen_zero(cmd) && (uuid = strdup(cmd))) {
+ if (!zstr(cmd) && (uuid = strdup(cmd))) {
if ((text = strchr(uuid, ' '))) {
*text++ = '\0';
}
}
- if (switch_strlen_zero(uuid) || switch_strlen_zero(text)) {
+ if (zstr(uuid) || zstr(text)) {
stream->write_function(stream, "-USAGE: %s\n", UUID_DEFLECT_SYNTAX);
} else {
if ((tsession = switch_core_session_locate(uuid))) {
@@ -1807,11 +1816,11 @@
char *mycmd = NULL, *argv[6] = { 0 };
int argc = 0;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
- if (switch_strlen_zero(cmd) || argc < 2 || argc > 5 || switch_strlen_zero(argv[0])) {
+ if (zstr(cmd) || argc < 2 || argc > 5 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", SCHED_TRANSFER_SYNTAX);
} else {
char *uuid = argv[1];
@@ -1846,11 +1855,11 @@
char *mycmd = NULL, *argv[4] = { 0 };
int argc = 0;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
- if (switch_strlen_zero(cmd) || argc < 1 || switch_strlen_zero(argv[0])) {
+ if (zstr(cmd) || argc < 1 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", SCHED_HANGUP_SYNTAX);
} else {
char *uuid = argv[1];
@@ -1888,11 +1897,11 @@
int argc = 0;
switch_status_t status = SWITCH_STATUS_FALSE;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
- if (switch_strlen_zero(cmd) || argc < 1 || switch_strlen_zero(argv[0])) {
+ if (zstr(cmd) || argc < 1 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", MEDIA_SYNTAX);
} else {
if (!strcasecmp(argv[0], "off")) {
@@ -1919,11 +1928,11 @@
int argc = 0;
switch_status_t status = SWITCH_STATUS_FALSE;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
- if (switch_strlen_zero(cmd) || argc < 2) {
+ if (zstr(cmd) || argc < 2) {
stream->write_function(stream, "-USAGE: %s\n", BROADCAST_SYNTAX);
} else {
switch_media_flag_t flags = SMF_NONE;
@@ -1955,11 +1964,11 @@
int argc = 0;
switch_status_t status = SWITCH_STATUS_FALSE;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
- if (switch_strlen_zero(cmd) || argc < 3 || switch_strlen_zero(argv[0])) {
+ if (zstr(cmd) || argc < 3 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", SCHED_BROADCAST_SYNTAX);
} else {
switch_media_flag_t flags = SMF_NONE;
@@ -1998,11 +2007,11 @@
int argc = 0;
switch_status_t status = SWITCH_STATUS_FALSE;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
- if (switch_strlen_zero(cmd) || argc < 1 || switch_strlen_zero(argv[0])) {
+ if (zstr(cmd) || argc < 1 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", HOLD_SYNTAX);
} else {
if (!strcasecmp(argv[0], "off")) {
@@ -2029,11 +2038,11 @@
int argc = 0;
switch_status_t status = SWITCH_STATUS_FALSE;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
- if (switch_strlen_zero(cmd) || argc < 2 || switch_strlen_zero(argv[0]) || switch_strlen_zero(argv[1])) {
+ if (zstr(cmd) || argc < 2 || zstr(argv[0]) || zstr(argv[1])) {
stream->write_function(stream, "-USAGE: %s\n", DISPLAY_SYNTAX);
} else {
switch_core_session_message_t msg = { 0 };
@@ -2059,17 +2068,93 @@
return SWITCH_STATUS_SUCCESS;
}
+#define WARNING_SYNTAX "<uuid> <warning>"
+SWITCH_STANDARD_API(uuid_warning_function)
+{
+ char *mycmd = NULL, *argv[2] = { 0 };
+ int argc = 0;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+
+ 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);
+ } 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.from = __FILE__;
+
+ if ((lsession = switch_core_session_locate(argv[0]))) {
+ status = switch_core_session_receive_message(lsession, &msg);
+ switch_core_session_rwunlock(lsession);
+ }
+ }
+
+ if (status == SWITCH_STATUS_SUCCESS) {
+ stream->write_function(stream, "+OK Success\n");
+ } else {
+ stream->write_function(stream, "-ERR Operation Failed\n");
+ }
+
+ switch_safe_free(mycmd);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+#define DEBUG_AUDIO_SYNTAX "<uuid> <read|write|both> <on|off>"
+SWITCH_STANDARD_API(uuid_debug_audio_function)
+{
+ char *mycmd = NULL, *argv[3] = { 0 };
+ int argc = 0;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
+ argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ }
+
+ if (zstr(cmd) || argc < 3 || zstr(argv[0]) || zstr(argv[1]) || zstr(argv[2])) {
+ stream->write_function(stream, "-USAGE: %s\n", DEBUG_AUDIO_SYNTAX);
+ } 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];
+ msg.from = __FILE__;
+
+ if ((lsession = switch_core_session_locate(argv[0]))) {
+ status = switch_core_session_receive_message(lsession, &msg);
+ switch_core_session_rwunlock(lsession);
+ }
+ }
+
+ if (status == SWITCH_STATUS_SUCCESS) {
+ stream->write_function(stream, "+OK Success\n");
+ } else {
+ stream->write_function(stream, "-ERR Operation Failed\n");
+ }
+
+ switch_safe_free(mycmd);
+ return SWITCH_STATUS_SUCCESS;
+}
+
#define UUID_SYNTAX "<uuid> <other_uuid>"
SWITCH_STANDARD_API(uuid_bridge_function)
{
char *mycmd = NULL, *argv[4] = { 0 };
int argc = 0;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
- if (switch_strlen_zero(cmd) || argc < 2) {
+ if (zstr(cmd) || argc < 2) {
stream->write_function(stream, "-USAGE: %s\n", UUID_SYNTAX);
} else {
switch_status_t status;
@@ -2105,7 +2190,7 @@
int argc = 0;
uint32_t limit = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
@@ -2122,7 +2207,7 @@
path = argv[2];
limit = argv[3] ? atoi(argv[3]) : 0;
- if (switch_strlen_zero(uuid) || switch_strlen_zero(action) || switch_strlen_zero(path)) {
+ if (zstr(uuid) || zstr(action) || zstr(path)) {
goto usage;
}
@@ -2171,7 +2256,7 @@
uint32_t limit = 0;
char *flags = NULL;
- if (switch_strlen_zero(cmd) || !(mycmd = strdup(cmd))) {
+ if (zstr(cmd) || !(mycmd = strdup(cmd))) {
goto usage;
}
@@ -2185,7 +2270,7 @@
limit = argv[3] ? atoi(argv[3]) : 0;
flags = argv[4];
- if (switch_strlen_zero(uuid) || switch_strlen_zero(action) || switch_strlen_zero(path)) {
+ if (zstr(uuid) || zstr(action) || zstr(path)) {
goto usage;
}
@@ -2232,7 +2317,7 @@
switch_channel_t *channel = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", BREAK_SYNTAX);
goto done;
}
@@ -2277,11 +2362,11 @@
char *mycmd = NULL, *argv[4] = { 0 };
int argc = 0;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
- if (switch_strlen_zero(cmd) || argc < 2 || switch_strlen_zero(argv[0])) {
+ if (zstr(cmd) || argc < 2 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", PAUSE_SYNTAX);
} else {
char *uuid = argv[0];
@@ -2320,7 +2405,7 @@
uint8_t machine = 1;
switch_status_t status = SWITCH_STATUS_SUCCESS;
- if (session || switch_strlen_zero(cmd)) {
+ if (session || zstr(cmd)) {
stream->write_function(stream, "-USAGE %s\n", ORIGINATE_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -3000,7 +3085,7 @@
/* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "SQL: %s.\n", sql); */
if (!strcasecmp(as, "delim") || !strcasecmp(as, "csv")) {
- if (switch_strlen_zero(holder.delim)) {
+ if (zstr(holder.delim)) {
if (!(holder.delim = argv[3])) {
holder.delim = ",";
}
@@ -3075,7 +3160,7 @@
{
char showcmd[1024];
int all = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
sprintf(showcmd, "help");
all = 1;
} else {
@@ -3100,7 +3185,7 @@
switch_core_session_t *l_session = NULL;
int x = 0, sched = 0;
- if (switch_strlen_zero(cmd) || !(mycmd = strdup(cmd))) {
+ if (zstr(cmd) || !(mycmd = strdup(cmd))) {
goto error;
}
@@ -3158,7 +3243,7 @@
{
switch_core_session_t *fsession;
- if (!switch_strlen_zero(cmd) && (fsession = switch_core_session_locate(cmd))) {
+ if (!zstr(cmd) && (fsession = switch_core_session_locate(cmd))) {
switch_channel_flush_dtmf(switch_core_session_get_channel(fsession));
switch_core_session_rwunlock(fsession);
stream->write_function(stream, "+OK\n");
@@ -3176,9 +3261,9 @@
char *mycmd = NULL, *argv[3] = { 0 };
int argc = 0;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
- if ((argc == 2 || argc == 3) && !switch_strlen_zero(argv[0])) {
+ if ((argc == 2 || argc == 3) && !zstr(argv[0])) {
char *uuid = argv[0];
char *var_name = argv[1];
char *var_value = NULL;
@@ -3191,7 +3276,7 @@
switch_channel_t *channel;
channel = switch_core_session_get_channel(psession);
- if (switch_strlen_zero(var_name)) {
+ if (zstr(var_name)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
stream->write_function(stream, "-ERR No variable specified\n");
} else {
@@ -3224,7 +3309,7 @@
int argc = 0;
char *var_name, *var_value = NULL;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
char *uuid = mycmd;
if (!(vars = strchr(uuid, ' '))) {
goto done;
@@ -3241,7 +3326,7 @@
if (var_name && (var_value = strchr(var_name, '='))) {
*var_value++ = '\0';
}
- if (switch_strlen_zero(var_name)) {
+ if (zstr(var_name)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
stream->write_function(stream, "-ERR No variable specified\n");
} else {
@@ -3267,19 +3352,15 @@
return SWITCH_STATUS_SUCCESS;
}
-#define EXISTS_SYNTAX "<uuid> <var>"
+#define EXISTS_SYNTAX "<uuid>"
SWITCH_STANDARD_API(uuid_exists_function)
{
- int exists = 0;
-
- if (cmd) {
- switch_core_session_t *psession = NULL;
- if ((psession = switch_core_session_locate(cmd))) {
- switch_core_session_rwunlock(psession);
- exists = 1;
- }
- }
+ switch_bool_t exists = SWITCH_FALSE;
+ if (cmd) {
+ exists = switch_ivr_uuid_exists(cmd);
+ }
+
stream->write_function(stream, "%s", exists ? "true" : "false");
return SWITCH_STATUS_SUCCESS;
@@ -3293,9 +3374,9 @@
char *mycmd = NULL, *argv[4] = { 0 };
int argc = 0;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
- if (argc >= 2 && !switch_strlen_zero(argv[0])) {
+ if (argc >= 2 && !zstr(argv[0])) {
char *uuid = argv[0];
char *var_name = argv[1];
const char *var_value = NULL;
@@ -3304,7 +3385,7 @@
switch_channel_t *channel;
channel = switch_core_session_get_channel(psession);
- if (switch_strlen_zero(var_name)) {
+ if (zstr(var_name)) {
stream->write_function(stream, "-ERR No variable name specified!\n");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
} else {
@@ -3340,7 +3421,7 @@
char *uuid = NULL, *dtmf_data = NULL;
int argc = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
@@ -3354,7 +3435,7 @@
uuid = argv[0];
dtmf_data = argv[1];
- if (switch_strlen_zero(uuid) || switch_strlen_zero(dtmf_data)) {
+ if (zstr(uuid) || zstr(dtmf_data)) {
goto usage;
}
@@ -3385,9 +3466,9 @@
char *mycmd = NULL, *argv[4] = { 0 };
int argc = 0;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
- if (argc >= 0 && !switch_strlen_zero(argv[0])) {
+ if (argc >= 0 && !zstr(argv[0])) {
char *uuid = argv[0];
char *format = argv[1];
@@ -3449,13 +3530,13 @@
char *mycmd = NULL, *argv[2] = { 0 };
int argc = 0;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, '=', argv, (sizeof(argv) / sizeof(argv[0])));
- if (argc > 0 && !switch_strlen_zero(argv[0])) {
+ if (argc > 0 && !zstr(argv[0])) {
char *var_name = argv[0];
char *var_value = argv[1];
- if (switch_strlen_zero(var_value)) {
+ if (zstr(var_value)) {
var_value = NULL;
}
switch_core_set_variable(var_name, var_value);
@@ -3474,7 +3555,7 @@
#define GLOBAL_GETVAR_SYNTAX "<var>"
SWITCH_STANDARD_API(global_getvar_function)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
switch_core_dump_variables(stream);
} else {
stream->write_function(stream, "%s", switch_str_nil(switch_core_get_variable(cmd)));
@@ -3485,7 +3566,7 @@
#define SYSTEM_SYNTAX "<command>"
SWITCH_STANDARD_API(system_function)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", SYSTEM_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -3502,7 +3583,7 @@
#define SYSTEM_SYNTAX "<command>"
SWITCH_STANDARD_API(bg_system_function)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", SYSTEM_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -3521,7 +3602,7 @@
const char *tz_name = NULL;
char date[80] = "";
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
format = strchr(cmd, ' ');
tz_name = cmd;
if (format) {
@@ -3546,7 +3627,7 @@
char *val = NULL;
switch_call_cause_t cause = SWITCH_CAUSE_MANAGER_REQUEST;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
switch_assert(argv[0]);
if ((cause = switch_channel_str2cause(argv[0])) == SWITCH_CAUSE_NONE) {
@@ -3560,13 +3641,13 @@
var = NULL;
}
- if (switch_strlen_zero(var)) {
+ if (zstr(var)) {
switch_core_session_hupall(cause);
} else {
switch_core_session_hupall_matching_var(var, val, cause);
}
- if (switch_strlen_zero(var)) {
+ 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));
@@ -3638,6 +3719,15 @@
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 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");
@@ -3659,6 +3749,8 @@
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_media", "media", uuid_media_function, MEDIA_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "fsctl", "control messages", ctl_function, CTL_SYNTAX);
switch_console_set_complete("add fsctl hupall");
@@ -3717,6 +3809,7 @@
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, "");
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_NOUNLOAD;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_conference/mod_conference.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_conference/mod_conference.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_conference/mod_conference.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -29,6 +29,7 @@
* Dale Thatcher <freeswitch at dalethatcher dot com>
* Chris Danielson <chris at maxpowersoft dot com>
* Rupa Schomaker <rupa@rupa.com>
+ * David Weekly <david@weekly.org>
*
* mod_conference.c -- Software Conference Bridge
*
@@ -287,6 +288,7 @@
switch_byte_t *not_talking_buf;
uint32_t not_talking_buf_len;
int comfort_noise_level;
+ int is_recording;
int video_running;
uint32_t eflags;
uint32_t verbose_events;
@@ -674,7 +676,7 @@
switch_snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->itteration);
conference_member_say(member, saymsg, 0);
} else {
- if (switch_strlen_zero(conference->special_announce)) {
+ if (zstr(conference->special_announce)) {
/* announce the total number of members in the conference */
if (conference->count >= conference->announce_count && conference->announce_count > 1) {
switch_snprintf(msg, sizeof(msg), "There are %d callers", conference->count);
@@ -962,28 +964,9 @@
switch_mutex_lock(globals.hash_mutex);
globals.threads++;
switch_mutex_unlock(globals.hash_mutex);
+
+ conference->is_recording = 0;
- if (conference->auto_record) {
- uint32_t sanity = 1200;
-
- while (!conference->members && --sanity) {
- switch_yield(100000);
- }
-
- 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);
- 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) {
- switch_safe_free(rfile);
- }
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Auto Record Failed. No members in conference.\n");
- }
- }
-
while (globals.running && !switch_test_flag(conference, CFLAG_DESTRUCT)) {
switch_size_t file_sample_len = samples;
switch_size_t file_data_len = samples * 2;
@@ -991,7 +974,7 @@
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 && !conference->async_fnode) {
+ } 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);
}
@@ -1026,6 +1009,24 @@
switch_mutex_unlock(imember->audio_in_mutex);
}
+ /* Start recording if there's more than one participant. */
+ 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);
+ 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) {
+ switch_safe_free(rfile);
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Auto Record Failed. No members in conference.\n");
+ }
+ }
+
+
if (members_with_video && conference->video_running != 1) {
launch_conference_video_thread(conference);
}
@@ -1881,7 +1882,7 @@
if (switch_test_flag(member, MFLAG_MUTE_DETECT) && !switch_test_flag(member, MFLAG_CAN_SPEAK)) {
- if (!switch_strlen_zero(member->conference->mute_detect_sound)) {
+ if (!zstr(member->conference->mute_detect_sound)) {
conference_member_play_file(member, member->conference->mute_detect_sound, 0);
}
@@ -2358,6 +2359,8 @@
switch_channel_clear_app_flag(channel, CF_APP_TAGGED);
switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
switch_core_session_set_read_codec(member->session, &member->read_codec);
+ } else {
+ switch_ivr_parse_all_messages(member->session);
}
if (use_timer) {
@@ -2779,7 +2782,7 @@
expanded = NULL;
}
if (!strncasecmp(file, "say:", 4)) {
- if (!switch_strlen_zero(file + 4)) {
+ if (!zstr(file + 4)) {
status = conference_member_say(member, file + 4, leadin);
}
goto done;
@@ -2790,7 +2793,7 @@
goto done;
}
file = dfile;
- } else if (!switch_strlen_zero(file)) {
+ } else if (!zstr(file)) {
status = conference_member_say(member, file, leadin);
goto done;
}
@@ -2850,7 +2853,7 @@
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
switch_status_t status = SWITCH_STATUS_FALSE;
- if (member == NULL || switch_strlen_zero(text))
+ if (member == NULL || zstr(text))
return SWITCH_STATUS_FALSE;
switch_assert(conference != NULL);
@@ -2932,7 +2935,7 @@
switch_assert(conference != NULL);
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
return SWITCH_STATUS_GENERR;
}
@@ -3120,7 +3123,7 @@
return SWITCH_STATUS_GENERR;
switch_clear_flag_locked(member, MFLAG_CAN_SPEAK);
- if (!switch_strlen_zero(member->conference->muted_sound)) {
+ if (!zstr(member->conference->muted_sound)) {
conference_member_play_file(member, member->conference->muted_sound, 0);
} else {
char msg[512];
@@ -3152,7 +3155,7 @@
if (stream != NULL) {
stream->write_function(stream, "OK unmute %u\n", member->id);
}
- if (!switch_strlen_zero(member->conference->unmuted_sound)) {
+ if (!zstr(member->conference->unmuted_sound)) {
conference_member_play_file(member, member->conference->unmuted_sound, 0);
} else {
char msg[512];
@@ -3247,7 +3250,7 @@
return SWITCH_STATUS_GENERR;
}
- if (switch_strlen_zero(dtmf)) {
+ if (zstr(dtmf)) {
stream->write_function(stream, "Invalid input!\n");
return SWITCH_STATUS_GENERR;
}
@@ -3389,9 +3392,12 @@
switch_hash_this(hi, NULL, NULL, &val);
conference = (conference_obj_t *) val;
- stream->write_function(stream, "Conference %s (%u member%s%s)\n",
+ stream->write_function(stream, "Conference %s (%u member%s rate: %u%s)\n",
conference->name,
- conference->count, conference->count == 1 ? "" : "s", switch_test_flag(conference, CFLAG_LOCKED) ? " locked" : "");
+ conference->count,
+ conference->count == 1 ? "" : "s",
+ conference->rate,
+ switch_test_flag(conference, CFLAG_LOCKED) ? " locked" : "");
count++;
if (!summary) {
if (pretty) {
@@ -3449,11 +3455,41 @@
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);
+ switch_snprintf(i, sizeof(i), "%u", conference->rate);
+ switch_xml_set_attr_d(x_conference, "rate", ival);
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");
+ }
+ if (switch_test_flag(conference, CFLAG_WAIT_MOD)) {
+ switch_xml_set_attr_d(x_conference, "wait_mod", "true");
+ }
+
+ if (switch_test_flag(conference, CFLAG_RUNNING)) {
+ switch_xml_set_attr_d(x_conference, "running", "true");
+ }
+
+ if (switch_test_flag(conference, CFLAG_ANSWERED)) {
+ switch_xml_set_attr_d(x_conference, "answered", "true");
+ }
+
+ if (switch_test_flag(conference, CFLAG_ENFORCE_MIN)) {
+ switch_xml_set_attr_d(x_conference, "enforce_min", "true");
+ }
+
+ if (switch_test_flag(conference, CFLAG_BRIDGE_TO)) {
+ switch_xml_set_attr_d(x_conference, "bridge_to", "true");
+ }
+
+ if (switch_test_flag(conference, CFLAG_DYNAMIC)) {
+ switch_xml_set_attr_d(x_conference, "dynamic", "true");
+ }
+
x_members = switch_xml_add_child_d(x_conference, "members", 0);
switch_assert(x_members);
@@ -3507,6 +3543,12 @@
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);
@@ -3612,7 +3654,7 @@
{
switch_event_t *event;
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
stream->write_function(stream, "(say) Error! No text.\n");
return SWITCH_STATUS_GENERR;
}
@@ -3642,7 +3684,7 @@
conference_member_t *member;
switch_event_t *event;
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
stream->write_function(stream, "(saymember) No Text!\n");
goto done;
}
@@ -3659,7 +3701,7 @@
id = atoi(workspace);
- if (!id || switch_strlen_zero(text)) {
+ if (!id || zstr(text)) {
stream->write_function(stream, "(saymember) No Text!\n");
goto done;
}
@@ -3902,7 +3944,7 @@
switch_assert(conference != NULL);
switch_assert(stream != NULL);
- if (argc > 3 && !switch_strlen_zero(argv[2])) {
+ if (argc > 3 && !zstr(argv[2])) {
int x;
conf_name = strdup(argv[2]);
@@ -4266,7 +4308,7 @@
const char *modified_cmdline = cmdline;
const char *cmd = conf_api_sub_commands[i].pname;
- if (!switch_strlen_zero(modified_cmdline) && (start_text = strstr(modified_cmdline, cmd))) {
+ if (!zstr(modified_cmdline) && (start_text = strstr(modified_cmdline, cmd))) {
modified_cmdline = start_text + strlen(cmd);
while (modified_cmdline && (*modified_cmdline == ' ' || *modified_cmdline == '\t')) {
modified_cmdline++;
@@ -4413,11 +4455,11 @@
caller_channel = switch_core_session_get_channel(session);
}
- if (switch_strlen_zero(cid_name)) {
+ if (zstr(cid_name)) {
cid_name = conference->caller_id_name;
}
- if (switch_strlen_zero(cid_num)) {
+ if (zstr(cid_num)) {
cid_num = conference->caller_id_number;
}
@@ -4802,7 +4844,7 @@
call_list = switch_channel_get_private(channel, "_conference_autocall_list_");
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
call_list = NULL;
} else {
np = switch_core_session_alloc(session, sizeof(*np));
@@ -4956,7 +4998,7 @@
}
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Invalid arguments\n");
return;
}
@@ -5113,11 +5155,11 @@
switch_channel_set_variable(channel, "conference_name", conference->name);
/* Set MOH from variable if not set */
- if(switch_strlen_zero(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(switch_strlen_zero(conference->perpetual_sound)) {
+ if(zstr(conference->perpetual_sound)) {
conference->perpetual_sound = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "conference_perpetual_sound"));
}
@@ -5147,7 +5189,7 @@
/* if this is not an outbound call, deal with conference pins */
- if (enforce_security && !switch_strlen_zero(dpin)) {
+ if (enforce_security && !zstr(dpin)) {
char pin_buf[80] = "";
int pin_retries = 3; /* XXX - this should be configurable - i'm too lazy to do it right now... */
int pin_valid = 0;
@@ -5251,7 +5293,7 @@
}
/* if we're using "bridge:" make an outbound call and bridge it in */
- if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
+ if (!zstr(bridgeto) && strcasecmp(bridgeto, "none")) {
switch_call_cause_t cause;
if (conference_outcall(conference, NULL, session, bridgeto, 60, NULL, NULL, NULL, &cause) != SWITCH_STATUS_SUCCESS) {
goto done;
@@ -5504,7 +5546,7 @@
switch_assert(conference != NULL);
for (i = 0, status = SWITCH_STATUS_SUCCESS; status == SWITCH_STATUS_SUCCESS && i < CCFNTBL_QTY; i++) {
- if (!switch_strlen_zero(ccfntbl[i].digits)) {
+ if (!zstr(ccfntbl[i].digits)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Installing default caller control action '%s' bound to '%s'.\n", ccfntbl[i].key, ccfntbl[i].digits);
action = (caller_control_action_t *) switch_core_alloc(conference->pool, sizeof(caller_control_action_t));
@@ -5540,7 +5582,7 @@
char *val = (char *) switch_xml_attr(xml_kvp, "digits");
char *data = (char *) switch_xml_attr_soft(xml_kvp, "data");
- if (!switch_strlen_zero(key) && !switch_strlen_zero(val)) {
+ if (!zstr(key) && !zstr(val)) {
uint32_t i;
/* scan through all of the valid actions, and if found, */
@@ -5632,7 +5674,7 @@
char *auto_record = NULL;
/* Validate the conference name */
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n");
return NULL;
}
@@ -5657,14 +5699,14 @@
var = buf;
}
- if (!strcasecmp(var, "rate") && !switch_strlen_zero(val)) {
+ if (!strcasecmp(var, "rate") && !zstr(val)) {
uint32_t tmp = atoi(val);
if (tmp == 8000 || tmp == 16000 || tmp == 32000 || tmp == 48000) {
rate = tmp;
}
- } else if (!strcasecmp(var, "domain") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "domain") && !zstr(val)) {
domain = val;
- } else if (!strcasecmp(var, "interval") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "interval") && !zstr(val)) {
uint32_t tmp = atoi(val);
if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) {
interval = tmp;
@@ -5672,59 +5714,59 @@
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") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "timer-name") && !zstr(val)) {
timer_name = val;
- } else if (!strcasecmp(var, "tts-engine") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "tts-engine") && !zstr(val)) {
tts_engine = val;
- } else if (!strcasecmp(var, "tts-voice") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "tts-voice") && !zstr(val)) {
tts_voice = val;
- } else if (!strcasecmp(var, "enter-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "enter-sound") && !zstr(val)) {
enter_sound = val;
- } else if (!strcasecmp(var, "exit-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "exit-sound") && !zstr(val)) {
exit_sound = val;
- } else if (!strcasecmp(var, "alone-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "alone-sound") && !zstr(val)) {
alone_sound = val;
- } else if (!strcasecmp(var, "perpetual-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "perpetual-sound") && !zstr(val)) {
perpetual_sound = val;
- } else if (!strcasecmp(var, "moh-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "moh-sound") && !zstr(val)) {
moh_sound = val;
- } else if (!strcasecmp(var, "ack-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "ack-sound") && !zstr(val)) {
ack_sound = val;
- } else if (!strcasecmp(var, "nack-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "nack-sound") && !zstr(val)) {
nack_sound = val;
- } else if (!strcasecmp(var, "muted-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "muted-sound") && !zstr(val)) {
muted_sound = val;
- } else if (!strcasecmp(var, "mute-detect-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "mute-detect-sound") && !zstr(val)) {
mute_detect_sound = val;
- } else if (!strcasecmp(var, "unmuted-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "unmuted-sound") && !zstr(val)) {
unmuted_sound = val;
- } else if (!strcasecmp(var, "locked-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "locked-sound") && !zstr(val)) {
locked_sound = val;
- } else if (!strcasecmp(var, "is-locked-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "is-locked-sound") && !zstr(val)) {
is_locked_sound = val;
- } else if (!strcasecmp(var, "is-unlocked-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "is-unlocked-sound") && !zstr(val)) {
is_unlocked_sound = val;
- } else if (!strcasecmp(var, "member-flags") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "member-flags") && !zstr(val)) {
member_flags = val;
- } else if (!strcasecmp(var, "conference-flags") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "conference-flags") && !zstr(val)) {
conference_flags = val;
- } else if (!strcasecmp(var, "kicked-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "kicked-sound") && !zstr(val)) {
kicked_sound = val;
- } else if (!strcasecmp(var, "pin") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "pin") && !zstr(val)) {
pin = val;
- } else if (!strcasecmp(var, "pin-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "pin-sound") && !zstr(val)) {
pin_sound = val;
- } else if (!strcasecmp(var, "bad-pin-sound") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "bad-pin-sound") && !zstr(val)) {
bad_pin_sound = val;
- } else if (!strcasecmp(var, "energy-level") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "energy-level") && !zstr(val)) {
energy_level = val;
- } else if (!strcasecmp(var, "caller-id-name") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "caller-id-name") && !zstr(val)) {
caller_id_name = val;
- } else if (!strcasecmp(var, "caller-id-number") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "caller-id-number") && !zstr(val)) {
caller_id_number = val;
- } else if (!strcasecmp(var, "caller-controls") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "caller-controls") && !zstr(val)) {
caller_controls = val;
- } else if (!strcasecmp(var, "comfort-noise") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "comfort-noise") && !zstr(val)) {
int tmp;
tmp = atoi(val);
if (tmp > 1 && tmp < 10000) {
@@ -5732,9 +5774,9 @@
} else if (switch_true(val)) {
comfort_noise_level = 1400;
}
- } else if (!strcasecmp(var, "sound-prefix") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "sound-prefix") && !zstr(val)) {
sound_prefix = val;
- } else if (!strcasecmp(var, "max-members") && !switch_strlen_zero(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) {
@@ -5744,20 +5786,20 @@
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") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "max-members-sound") && !zstr(val)) {
maxmember_sound = val;
- } else if (!strcasecmp(var, "announce-count") && !switch_strlen_zero(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") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "suppress-events") && !zstr(val)) {
suppress_events = val;
- } else if (!strcasecmp(var, "verbose-events") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "verbose-events") && !zstr(val)) {
verbose_events = val;
- } else if (!strcasecmp(var, "auto-record") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "auto-record") && !zstr(val)) {
auto_record = val;
}
}
@@ -5765,17 +5807,17 @@
/* Set defaults and various paramaters */
/* Timer module to use */
- if (switch_strlen_zero(timer_name)) {
+ if (zstr(timer_name)) {
timer_name = "soft";
}
/* Caller ID Name */
- if (switch_strlen_zero(caller_id_name)) {
+ if (zstr(caller_id_name)) {
caller_id_name = (char *) global_app_name;
}
/* Caller ID Number */
- if (switch_strlen_zero(caller_id_number)) {
+ if (zstr(caller_id_number)) {
caller_id_number = "0000000000";
}
@@ -5815,13 +5857,13 @@
conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
- if (!switch_strlen_zero(perpetual_sound)) {
+ if (!zstr(perpetual_sound)) {
conference->perpetual_sound = switch_core_strdup(conference->pool, perpetual_sound);
}
conference->mflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
- if (!switch_strlen_zero(moh_sound) && switch_is_moh(moh_sound)) {
+ if (!zstr(moh_sound) && switch_is_moh(moh_sound)) {
conference->moh_sound = switch_core_strdup(conference->pool, moh_sound);
}
@@ -5837,75 +5879,75 @@
conference->sound_prefix = switch_core_strdup(conference->pool, sound_prefix);
}
- if (!switch_strlen_zero(enter_sound)) {
+ if (!zstr(enter_sound)) {
conference->enter_sound = switch_core_strdup(conference->pool, enter_sound);
}
- if (!switch_strlen_zero(exit_sound)) {
+ if (!zstr(exit_sound)) {
conference->exit_sound = switch_core_strdup(conference->pool, exit_sound);
}
- if (!switch_strlen_zero(ack_sound)) {
+ if (!zstr(ack_sound)) {
conference->ack_sound = switch_core_strdup(conference->pool, ack_sound);
}
- if (!switch_strlen_zero(nack_sound)) {
+ if (!zstr(nack_sound)) {
conference->nack_sound = switch_core_strdup(conference->pool, nack_sound);
}
- if (!switch_strlen_zero(muted_sound)) {
+ if (!zstr(muted_sound)) {
conference->muted_sound = switch_core_strdup(conference->pool, muted_sound);
}
- if (switch_strlen_zero(mute_detect_sound)) {
- if (!switch_strlen_zero(muted_sound)) {
+ if (zstr(mute_detect_sound)) {
+ if (!zstr(muted_sound)) {
conference->mute_detect_sound = switch_core_strdup(conference->pool, muted_sound);
}
} else {
conference->mute_detect_sound = switch_core_strdup(conference->pool, mute_detect_sound);
}
- if (!switch_strlen_zero(unmuted_sound)) {
+ if (!zstr(unmuted_sound)) {
conference->unmuted_sound = switch_core_strdup(conference->pool, unmuted_sound);
}
- if (!switch_strlen_zero(kicked_sound)) {
+ if (!zstr(kicked_sound)) {
conference->kicked_sound = switch_core_strdup(conference->pool, kicked_sound);
}
- if (!switch_strlen_zero(pin_sound)) {
+ if (!zstr(pin_sound)) {
conference->pin_sound = switch_core_strdup(conference->pool, pin_sound);
}
- if (!switch_strlen_zero(bad_pin_sound)) {
+ if (!zstr(bad_pin_sound)) {
conference->bad_pin_sound = switch_core_strdup(conference->pool, bad_pin_sound);
}
- if (!switch_strlen_zero(pin)) {
+ if (!zstr(pin)) {
conference->pin = switch_core_strdup(conference->pool, pin);
}
- if (!switch_strlen_zero(alone_sound)) {
+ if (!zstr(alone_sound)) {
conference->alone_sound = switch_core_strdup(conference->pool, alone_sound);
}
- if (!switch_strlen_zero(locked_sound)) {
+ if (!zstr(locked_sound)) {
conference->locked_sound = switch_core_strdup(conference->pool, locked_sound);
}
- if (!switch_strlen_zero(is_locked_sound)) {
+ if (!zstr(is_locked_sound)) {
conference->is_locked_sound = switch_core_strdup(conference->pool, is_locked_sound);
}
- if (!switch_strlen_zero(is_unlocked_sound)) {
+ if (!zstr(is_unlocked_sound)) {
conference->is_unlocked_sound = switch_core_strdup(conference->pool, is_unlocked_sound);
}
- if (!switch_strlen_zero(energy_level)) {
+ if (!zstr(energy_level)) {
conference->energy_level = atoi(energy_level);
}
- if (!switch_strlen_zero(maxmember_sound)) {
+ if (!zstr(maxmember_sound)) {
conference->maxmember_sound = switch_core_strdup(conference->pool, maxmember_sound);
}
/* its going to be 0 by default, set to a value otherwise so this should be safe */
@@ -5923,15 +5965,15 @@
conference->dtmf_parser = NULL;
conference->eflags = 0xFFFFFFFF;
- if (!switch_strlen_zero(suppress_events)) {
+ if (!zstr(suppress_events)) {
clear_eflags(suppress_events, &conference->eflags);
}
- if (!switch_strlen_zero(auto_record)) {
+ if (!zstr(auto_record)) {
conference->auto_record = switch_core_strdup(conference->pool, auto_record);
}
- if (!switch_strlen_zero(verbose_events) && switch_true(verbose_events)) {
+ if (!zstr(verbose_events) && switch_true(verbose_events)) {
conference->verbose_events = 1;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_curl/mod_curl.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_curl/mod_curl.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_curl/mod_curl.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -151,7 +151,7 @@
curl_easy_cleanup(curl_handle);
if ( http_data->stream.data &&
- !switch_strlen_zero((char *)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);
@@ -185,7 +185,7 @@
*data = '\0';
}
- if switch_strlen_zero(header->data) {
+ if zstr(header->data) {
header = header->next;
continue;
}
@@ -336,7 +336,7 @@
switch_memory_pool_t *pool = NULL;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
}
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_directory/Makefile (from rev 15313, freeswitch/trunk/src/mod/applications/mod_directory/Makefile) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_directory/Makefile (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_directory/Makefile 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,2 @@
+BASE=../../../..
+include $(BASE)/build/modmake.rules
\ No newline at end of file
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_directory/mod_directory.2008.vcproj (from rev 15313, freeswitch/trunk/src/mod/applications/mod_directory/mod_directory.2008.vcproj) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_directory/mod_directory.2008.vcproj (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_directory/mod_directory.2008.vcproj 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,287 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="mod_directory"
+ ProjectGUID="{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}"
+ RootNamespace="mod_directory"
+ 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"
+ 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="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"
+ 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"
+ 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"
+ 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"
+ 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_directory.c"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_directory/mod_directory.c (from rev 15313, freeswitch/trunk/src/mod/applications/mod_directory/mod_directory.c) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_directory/mod_directory.c (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_directory/mod_directory.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,988 @@
+/*
+ * 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):
+ *
+ * Marc Olivier Chouinard <mochouinard at moctel dot com>
+ *
+ *
+ * mod_directory.c -- Search by Name Directory IVR
+ *
+ */
+#include <switch.h>
+
+/* Prototypes */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_directory_shutdown);
+SWITCH_MODULE_LOAD_FUNCTION(mod_directory_load);
+
+SWITCH_MODULE_DEFINITION(mod_directory, mod_directory_load, mod_directory_shutdown, NULL);
+
+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";
+
+#define DIR_RESULT_ITEM "directory_result_item"
+#define DIR_RESULT_SAY_NAME "directory_result_say_name"
+#define DIR_RESULT_AT "directory_result_at"
+#define DIR_RESULT_MENU "directory_result_menu"
+#define DIR_INTRO "directory_intro"
+#define DIR_MIN_SEARCH_DIGITS "directory_min_search_digits"
+#define DIR_RESULT_COUNT "directory_result_count"
+#define DIR_RESULT_COUNT_TOO_LARGE "directory_result_count_too_large"
+#define DIR_RESULT_LAST "directory_result_last"
+
+static switch_xml_config_string_options_t config_dtmf = { NULL, 2, "[0-9#\\*]" };
+static switch_xml_config_int_options_t config_int_digit_timeout = { SWITCH_TRUE, 0, SWITCH_TRUE, 30000 };
+static switch_xml_config_int_options_t config_int_ht_0 = { SWITCH_TRUE, 0 };
+
+static struct {
+ switch_hash_t *profile_hash;
+ char hostname[256];
+ int integer;
+ int debug;
+ char *dbname;
+ switch_mutex_t *mutex;
+ switch_memory_pool_t *pool;
+} globals;
+
+#define DIR_PROFILE_CONFIGITEM_COUNT 100
+
+struct dir_profile {
+ char *name;
+
+ char next_key[2];
+ char prev_key[2];
+ char select_name_key[2];
+ char new_search_key[2];
+
+ char terminator_key[2];
+ char switch_order_key[2];
+
+ char *search_order;
+
+ uint32_t min_search_digits;
+ uint32_t max_menu_attempt;
+ uint32_t digit_timeout;
+ uint32_t max_result;
+ switch_mutex_t *mutex;
+
+ switch_thread_rwlock_t *rwlock;
+ switch_memory_pool_t *pool;
+
+ switch_xml_config_item_t config[DIR_PROFILE_CONFIGITEM_COUNT];
+ switch_xml_config_string_options_t config_str_pool;
+ uint32_t flags;
+};
+
+typedef struct dir_profile dir_profile_t;
+
+typedef enum {
+ PFLAG_DESTROY = 1 << 0
+} dir_flags_t;
+
+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;
+ }
+
+
+ return result;
+
+}
+
+char *string_to_keypad_digit(const char *in)
+{
+ const char *s = NULL;
+ char *dst = NULL;
+ char *d = NULL;
+
+ if (in) {
+ s = in;
+ dst = strdup(in);
+ d = dst;
+
+ while (*s) {
+ char c;
+ if ((c = digit_matching_keypad(*s++)) > 0) {
+ *d++ = c + 48;
+ }
+ }
+ if (*d) {
+ *d = '\0';
+ }
+ }
+ return dst;
+}
+
+static switch_status_t directory_execute_sql(char *sql, switch_mutex_t *mutex)
+{
+ switch_core_db_t *db;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+ if (mutex) {
+ switch_mutex_lock(mutex);
+ }
+
+ if (!(db = switch_core_db_open_file(globals.dbname))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
+ status = SWITCH_STATUS_FALSE;
+ goto end;
+ }
+ status = switch_core_db_persistant_execute(db, sql, 1);
+ switch_core_db_close(db);
+
+end:
+ if (mutex) {
+ switch_mutex_unlock(mutex);
+ }
+
+ return status;
+}
+
+typedef enum {
+ ENTRY_MOVE_NEXT,
+ ENTRY_MOVE_PREV
+} entry_move_t;
+
+struct search_params {
+ char digits[255];
+ char transfer_to[255];
+ char domain[255];
+ char profile[255];
+ int search_by_last_name;
+ int timeout;
+ int try_again;
+};
+typedef struct search_params search_params_t;
+
+struct listing_callback {
+ char extension[255];
+ char fullname[255];
+ char first_name[255];
+ char last_name[255];
+ char transfer_to[255];
+ int name_visible;
+ int exten_visible;
+ int new_search;
+ int index;
+ int want;
+ entry_move_t move;
+ search_params_t *params;
+};
+typedef struct listing_callback listing_callback_t;
+
+static int listing_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+ listing_callback_t *cbt = (listing_callback_t *) pArg;
+ if (cbt->index++ != cbt->want) {
+ return 0;
+ }
+ switch_copy_string(cbt->extension, argv[0], 255);
+ switch_copy_string(cbt->fullname, argv[1], 255);
+ switch_copy_string(cbt->last_name, argv[2], 255);
+ switch_copy_string(cbt->first_name, argv[3], 255);
+ cbt->name_visible = atoi(argv[4]);
+ cbt->exten_visible = atoi(argv[5]);
+ return -1;
+}
+
+
+struct callback {
+ char *buf;
+ size_t len;
+ int matches;
+};
+typedef struct callback callback_t;
+
+static int sql2str_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+ callback_t *cbt = (callback_t *) pArg;
+
+ switch_copy_string(cbt->buf, argv[0], cbt->len);
+ cbt->matches++;
+ return 0;
+}
+
+static switch_bool_t directory_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;
+
+ if (mutex) {
+ switch_mutex_lock(mutex);
+ }
+
+ 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;
+ }
+
+ switch_core_db_exec(db, sql, callback, pdata, &errmsg);
+
+ if (errmsg) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg);
+ free(errmsg);
+ }
+
+ if (db) {
+ switch_core_db_close(db);
+ }
+
+end:
+ if (mutex) {
+ switch_mutex_unlock(mutex);
+ }
+
+ return ret;
+}
+
+#define DIR_DESC "directory"
+#define DIR_USAGE "<profile_name> <domain_name>"
+
+static void free_profile(dir_profile_t *profile)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Profile %s\n", profile->name);
+ switch_core_destroy_memory_pool(&profile->pool);
+}
+
+static void profile_rwunlock(dir_profile_t *profile)
+{
+ switch_thread_rwlock_unlock(profile->rwlock);
+ if (switch_test_flag(profile, PFLAG_DESTROY)) {
+ if (switch_thread_rwlock_tryrdlock(profile->rwlock) == SWITCH_STATUS_SUCCESS) {
+ free_profile(profile);
+ }
+ }
+}
+
+dir_profile_t *profile_set_config(dir_profile_t *profile)
+{
+ int i = 0;
+
+ 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++], "terminator-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+ &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);
+ SWITCH_CONFIG_SET_ITEM(profile->config[i++], "select-name-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+ &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);
+ 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);
+ SWITCH_CONFIG_SET_ITEM(profile->config[i++], "digit-timeout", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
+ &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);
+ 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);
+ SWITCH_CONFIG_SET_ITEM(profile->config[i++], "max-result", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
+ &profile->max_result, 5, &config_int_ht_0, NULL, NULL);
+
+ return profile;
+
+}
+
+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;
+ switch_event_t *event = 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);
+ return profile;
+ }
+ if (!(x_profiles = switch_xml_child(cfg, "profiles"))) {
+ goto end;
+ }
+
+ if ((x_profile = switch_xml_find_child(x_profiles, "profile", "name", profile_name))) {
+ switch_memory_pool_t *pool;
+ int count;
+
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ goto end;
+ }
+
+ if (!(profile = switch_core_alloc(pool, sizeof(dir_profile_t)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+ switch_core_destroy_memory_pool(&pool);
+ goto end;
+ }
+
+ profile->pool = pool;
+ profile_set_config(profile);
+
+ /* Add the params to the event structure */
+ count = switch_event_import_xml(switch_xml_child(x_profile, "param"), "name", "value", &event);
+
+ 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);
+
+ switch_mutex_init(&profile->mutex, SWITCH_MUTEX_NESTED, profile->pool);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added Profile %s\n", profile->name);
+ switch_core_hash_insert(globals.profile_hash, profile->name, profile);
+ }
+
+end:
+ switch_xml_free(xml);
+
+ return profile;
+}
+
+static switch_status_t load_config(switch_bool_t reload)
+{
+ switch_xml_t cfg, xml = NULL, settings, param, x_profiles, x_profile;
+
+ 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);
+ return SWITCH_STATUS_TERM;
+ }
+
+ switch_mutex_lock(globals.mutex);
+ 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 (!strcasecmp(var, "debug")) {
+ globals.debug = atoi(val);
+ }
+ }
+ }
+
+ if ((x_profiles = switch_xml_child(cfg, "profiles"))) {
+ for (x_profile = switch_xml_child(x_profiles, "profile"); x_profile; x_profile = x_profile->next) {
+ load_profile(switch_xml_attr_soft(x_profile, "name"));
+ }
+ }
+ switch_mutex_unlock(globals.mutex);
+
+ switch_xml_free(xml);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static dir_profile_t * get_profile(const char *profile_name)
+{
+ dir_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);
+ }
+ 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);
+
+ return profile;
+}
+
+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;
+ char *sqlvalues = NULL;
+ char *sqltmp = NULL;
+
+ switch_xml_t xml_root = NULL, x_domain;
+ switch_xml_t ut;
+
+ switch_event_t *xml_params = NULL;
+ switch_xml_t group = NULL, groups = NULL, users = NULL, x_params = NULL, x_param = NULL, x_vars = NULL, x_var = NULL;
+ switch_event_create(&xml_params, SWITCH_EVENT_REQUEST_PARAMS);
+ switch_assert(xml_params);
+
+ if (switch_xml_locate_domain(domain_name, xml_params, &xml_root, &x_domain) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate domain %s\n", domain_name);
+ status = SWITCH_STATUS_FALSE;
+ goto end;
+ }
+
+ if ((groups = switch_xml_child(x_domain, "groups"))) {
+ for (group = switch_xml_child(groups, "group"); group; group = group->next) {
+ if ((users = switch_xml_child(group, "users"))) {
+ for (ut = switch_xml_child(users, "user"); ut; ut = ut->next) {
+ int name_visible = 1;
+ int exten_visible = 1;
+ const char *type = switch_xml_attr_soft(ut, "type");
+ const char *id = switch_xml_attr_soft(ut, "id");
+ char *fullName = NULL;
+ char *caller_name = NULL;
+ char *caller_name_override = NULL;
+ char *firstName = NULL;
+ char *lastName = NULL;
+ char *fullNameDigit = NULL;
+ char *firstNameDigit = NULL;
+ char *lastNameDigit = NULL;
+
+ if (!strcasecmp(type, "pointer")) {
+ continue;
+ }
+ /* Check all the user params */
+ if ((x_params = switch_xml_child(ut, "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, "directory-visible")) {
+ name_visible = switch_true(val);
+ }
+ if (!strcasecmp(var, "directory-exten-visible")) {
+ exten_visible = switch_true(val);
+ }
+
+ }
+ }
+ /* Check all the user variables */
+ if ((x_vars = switch_xml_child(ut, "variables"))) {
+ for (x_var = switch_xml_child(x_vars, "variable"); x_var; x_var = x_var->next) {
+ const char *var = switch_xml_attr_soft(x_var, "name");
+ const char *val = switch_xml_attr_soft(x_var, "value");
+ if (!strcasecmp(var, "effective_caller_id_name")) {
+ caller_name = switch_core_session_strdup(session, val);
+ }
+ if (!strcasecmp(var, "directory_full_name")) {
+ caller_name_override = switch_core_session_strdup(session, val);
+ }
+ }
+ }
+ if (caller_name_override) {
+ fullName = caller_name_override;
+ } else {
+ fullName = caller_name;
+ }
+ if (zstr(fullName)) {
+ continue;
+ }
+ firstName = switch_core_session_strdup(session, fullName);
+
+ if ((lastName = strrchr(firstName, ' '))) {
+ *lastName++ = '\0';
+ } else {
+ lastName = switch_core_session_strdup(session, firstName);
+ }
+
+ /* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "FullName %s firstName [%s] lastName [%s]\n", fullName, firstName, lastName); */
+
+ /* Generate Digits key mapping */
+ fullNameDigit = string_to_keypad_digit(fullName);
+ lastNameDigit = string_to_keypad_digit(lastName);
+ 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);
+
+ if (sqlvalues) {
+ sqltmp = sqlvalues;
+ sqlvalues = switch_mprintf("%s;%s", sqlvalues, sql);
+ switch_safe_free(sqltmp);
+ } else {
+ sqlvalues = sql;
+ sql = NULL;
+ }
+ switch_safe_free(sql);
+ switch_safe_free(fullNameDigit);
+ switch_safe_free(lastNameDigit);
+ switch_safe_free(firstNameDigit);
+ }
+ }
+ }
+ }
+ sql = switch_mprintf("BEGIN;%s;COMMIT;",sqlvalues);
+ directory_execute_sql(sql, profile->mutex);
+
+end:
+ switch_safe_free(sql);
+ switch_safe_free(sqlvalues);
+ switch_event_destroy(&xml_params);
+ switch_xml_free(xml_root);
+
+ return status;
+}
+
+struct cb_result {
+ char digits[255];
+ char digit;
+ dir_profile_t *profile;
+};
+
+typedef struct cb_result cbr_t;
+
+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;
+ }
+
+ 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;
+ }
+
+ return SWITCH_STATUS_BREAK;
+}
+
+static switch_status_t listen_entry(switch_core_session_t *session, dir_profile_t *profile, listing_callback_t *cbt)
+{
+ char buf[2] = "";
+ char macro[256] = "";
+ char recorded_name[256] = "";
+
+ /* Try to use the recorded name from voicemail if it exist */
+ if (switch_loadable_module_exists("mod_voicemail") == SWITCH_STATUS_SUCCESS) {
+ char *cmd = NULL;
+ switch_stream_handle_t stream = { 0 };
+ SWITCH_STANDARD_STREAM(stream);
+
+ cmd = switch_core_session_sprintf(session, "%s/%s@%s|name_path", cbt->params->profile, cbt->extension, cbt->params->domain);
+ switch_api_execute("vm_prefs", cmd, session, &stream);
+ if (strncmp("-ERR", stream.data, 4)) {
+ switch_copy_string(recorded_name, (char *) stream.data, sizeof(recorded_name));
+ }
+ switch_safe_free(stream.data);
+ }
+
+ if (zstr_buf(buf)) {
+ 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);
+
+ }
+ if (zstr_buf(recorded_name) && zstr_buf(buf)) {
+ switch_snprintf(macro, sizeof(macro), "phrase:%s:%s", DIR_RESULT_SAY_NAME, cbt->fullname);
+ switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key);
+ }
+ if (cbt->exten_visible && zstr_buf(buf)) {
+ switch_snprintf(macro, sizeof(macro), "phrase:%s:%s", DIR_RESULT_AT, cbt->extension);
+ 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_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), profile->digit_timeout, profile->terminator_key);
+ }
+
+ if (!zstr_buf(buf)) {
+ if (buf[0] == *profile->select_name_key) {
+ switch_copy_string(cbt->transfer_to, cbt->extension, 255);
+ }
+ if (buf[0] == *profile->new_search_key) {
+ cbt->new_search = 1;
+ }
+ if (buf[0] == *profile->prev_key) {
+ cbt->move = ENTRY_MOVE_PREV;
+ }
+ } else {
+ return SWITCH_STATUS_TIMEOUT;
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+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;
+ int loop = 1;
+
+ switch_input_args_t args = { 0 };
+ args.input_callback = on_dtmf;
+ args.buf = &cbr;
+
+ while (switch_channel_ready(channel) && loop) {
+ char macro[255];
+ loop = 0;
+ memset(&cbr, 0, sizeof(cbr));
+ cbr.profile = profile;
+ params->timeout = 0;
+
+ /* 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_ivr_phrase_macro(session, DIR_INTRO, macro, NULL, &args);
+
+ while (switch_channel_ready(channel)) {
+ if (cbr.digit == *profile->terminator_key) {
+ status = SWITCH_STATUS_BREAK;
+ break;
+ }
+ if (cbr.digit == *profile->switch_order_key) {
+ if (params->search_by_last_name) {
+ params->search_by_last_name = 0;
+ } else {
+ params->search_by_last_name = 1;
+ }
+ loop = 1;
+ break;
+ }
+
+ if (switch_ivr_collect_digits_callback(session, &args, profile->digit_timeout, 0) == SWITCH_STATUS_TIMEOUT) {
+ params->timeout = 1;
+ break;
+ }
+
+ }
+ }
+ switch_copy_string(params->digits, cbr.digits, 255);
+
+ return status;
+}
+
+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] = "";
+ callback_t cbt = { 0 };
+ int result_count;
+ char macro[256] = "";
+ listing_callback_t listing_cbt;
+ int cur_entry = 0;
+ 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);
+
+ directory_execute_sql_callback(profile->mutex, sql, sql2str_callback, &cbt);
+ switch_safe_free(sql);
+
+ result_count = atoi(entry_count);
+
+ if (result_count == 0) {
+ switch_snprintf(macro, sizeof(macro), "%d", result_count);
+ switch_ivr_phrase_macro(session, DIR_RESULT_COUNT, macro, NULL, NULL);
+ params->try_again = 1;
+ return SWITCH_STATUS_BREAK;
+ } else if (profile->max_result != 0 && result_count > profile->max_result) {
+ switch_ivr_phrase_macro(session, DIR_RESULT_COUNT_TOO_LARGE, NULL, NULL, NULL);
+ params->try_again = 1;
+ return SWITCH_STATUS_BREAK;
+ } else {
+ switch_snprintf(macro, sizeof(macro), "%d", result_count);
+ switch_ivr_phrase_macro(session, DIR_RESULT_COUNT, macro, NULL, NULL);
+ }
+
+ 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);
+
+ for (cur_entry = 0; cur_entry < result_count; cur_entry++) {
+ listing_cbt.index = 0;
+ listing_cbt.want = cur_entry;
+ listing_cbt.move = ENTRY_MOVE_NEXT;
+ directory_execute_sql_callback(profile->mutex, sql, listing_callback, &listing_cbt);
+ status = listen_entry(session, profile, &listing_cbt);
+ if (!zstr(listing_cbt.transfer_to)) {
+ switch_copy_string(params->transfer_to, listing_cbt.transfer_to, 255);
+ break;
+ }
+ if (listing_cbt.new_search) {
+ params->try_again = 1;
+ goto end;
+
+ }
+ if (listing_cbt.move == ENTRY_MOVE_NEXT) {
+ if (cur_entry == result_count - 1) {
+ switch_snprintf(macro, sizeof(macro), "%d", result_count);
+ switch_ivr_phrase_macro(session, DIR_RESULT_LAST, macro, NULL, NULL);
+ cur_entry -= 1;
+ }
+ }
+ if (listing_cbt.move == ENTRY_MOVE_PREV) {
+ if (cur_entry <= 0) {
+ cur_entry = -1;
+ } else {
+ cur_entry -= 2;
+ }
+ }
+ if (status == SWITCH_STATUS_TIMEOUT) {
+ goto end;
+ }
+ if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
+ goto end;
+ }
+ }
+
+end:
+ switch_safe_free(sql);
+ return status;
+
+}
+
+SWITCH_STANDARD_APP(directory_function)
+{
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ int argc = 0;
+ char *argv[6] = { 0 };
+ char *mydata = NULL;
+ const char *profile_name = NULL;
+ const char *domain_name = NULL;
+ dir_profile_t * profile = NULL;
+ int x = 0;
+ char *sql = NULL;
+ search_params_t s_param;
+ int attempts = 3;
+ char macro[255];
+
+ if (zstr(data)) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing profile name\n");
+ return;
+ }
+
+ mydata = switch_core_session_strdup(session, data);
+ argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+
+ if (argv[x]) {
+ profile_name = argv[x++];
+ }
+
+ if (argv[x]) {
+ domain_name = argv[x++];
+ }
+
+ if (!(profile = get_profile(profile_name))) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error invalid profile %s\n", profile_name);
+ return;
+ }
+
+ populate_database(session, profile, domain_name);
+
+ memset(&s_param, 0, sizeof(s_param));
+ s_param.search_by_last_name = 1;
+ s_param.try_again = 1;
+ switch_copy_string(s_param.profile, profile_name, 255);
+ switch_copy_string(s_param.domain, domain_name, 255);
+
+ if (strcasecmp(profile->search_order, "last_name")) {
+ s_param.search_by_last_name = 0;
+ }
+ attempts = profile->max_menu_attempt;
+ 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);
+
+ if (zstr(s_param.digits)) {
+ s_param.try_again = 1;
+ continue;
+ }
+
+ if (strlen(s_param.digits) < profile->min_search_digits) {
+ switch_snprintf(macro, sizeof(macro), "%d", profile->min_search_digits);
+ switch_ivr_phrase_macro(session, DIR_MIN_SEARCH_DIGITS, macro, NULL, NULL);
+ s_param.try_again = 1;
+ continue;
+ }
+
+ navigate_entrys(session, profile, &s_param);
+ }
+
+ if (!zstr(s_param.transfer_to)) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Directory transfering call to : %s\n", s_param.transfer_to);
+ switch_ivr_session_transfer(session, s_param.transfer_to, "XML", domain_name);
+ }
+
+ /* Delete all sql entry for this call */
+ 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);
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_directory_load)
+{
+ switch_application_interface_t *app_interface;
+ switch_status_t status;
+ switch_core_db_t *db = NULL;
+ char *sql = NULL;
+
+ memset(&globals, 0, sizeof(globals));
+ globals.pool = pool;
+
+ switch_core_hash_init(&globals.profile_hash, globals.pool);
+ switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
+
+ if ((status = load_config(SWITCH_FALSE)) != SWITCH_STATUS_SUCCESS) {
+ return status;
+ }
+
+ /* connect my internal structure to the blank pointer passed to me */
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+ gethostname(globals.hostname, sizeof(globals.hostname));
+
+ globals.dbname = switch_core_sprintf(pool, "directory");
+
+ if ((db = switch_core_db_open_file(globals.dbname))) {
+ switch_core_db_test_reactive(db, "select count(uuid),name_visible from directory_search", "drop table directory_search", dir_sql);
+ switch_core_db_close(db);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open db name : %s\n", globals.dbname);
+ return SWITCH_STATUS_FALSE;
+ }
+
+ sql = switch_mprintf("delete from directory_search where hostname = '%q'", globals.hostname);
+ directory_execute_sql(sql, globals.mutex);
+ switch_safe_free(sql);
+
+ SWITCH_ADD_APP(app_interface, "directory", "directory", DIR_DESC, directory_function, DIR_USAGE, SAF_NONE);
+
+ /* indicate that the module should continue to be loaded */
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/*
+ Called when the system shuts down
+ Macro expands to: switch_status_t mod_directory_shutdown() */
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_directory_shutdown)
+{
+ switch_hash_index_t *hi;
+ dir_profile_t *profile;
+ void *val = NULL;
+ const void *key;
+ switch_ssize_t keylen;
+ char *sql = NULL;
+
+ switch_mutex_lock(globals.mutex);
+
+ while((hi = switch_hash_first(NULL, globals.profile_hash))) {
+ switch_hash_this(hi, &key, &keylen, &val);
+ profile = (dir_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_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);
+ profile = NULL;
+ }
+
+ sql = switch_mprintf("delete from directory_search where hostname = '%q'", globals.hostname);
+ directory_execute_sql(sql, globals.mutex);
+ switch_safe_free(sql);
+
+ switch_mutex_unlock(globals.mutex);
+ 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_experimental_refactor/src/mod/applications/mod_directory/mod_directory.vcproj (from rev 15313, freeswitch/trunk/src/mod/applications/mod_directory/mod_directory.vcproj) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_directory/mod_directory.vcproj (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_directory/mod_directory.vcproj 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="mod_directory"
+ ProjectGUID="{75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}"
+ RootNamespace="mod_directory"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </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"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <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\module_release.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <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_directory.c"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_dptools/mod_dptools.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_dptools/mod_dptools.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_dptools/mod_dptools.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -55,11 +55,11 @@
abort();
}
- if (switch_strlen_zero(target)) {
+ if (zstr(target)) {
target = caller_profile->destination_number;
}
- if (!switch_strlen_zero(target) && (lbuf = switch_core_session_strdup(session, target))
+ if (!zstr(target) && (lbuf = switch_core_session_strdup(session, target))
&& (argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
} else {
return NULL;
@@ -91,7 +91,7 @@
int argc;
char *lbuf = NULL;
- if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
+ if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
if (!strcasecmp(argv[0], "grammar") && argc >= 1) {
switch_ivr_detect_speech_load_grammar(session, argv[1], argv[2]);
@@ -154,7 +154,7 @@
int argc;
char *lbuf = NULL;
- if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
+ if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
switch_core_session_execute_exten(session, argv[0], argv[1], argv[2]);
} else {
@@ -176,7 +176,7 @@
int argc;
char *lbuf = NULL;
- if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
+ if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
switch_ivr_soft_hold(session, argv[0], argv[1], argv[2]);
} else {
@@ -205,7 +205,7 @@
int argc;
char *lbuf = NULL;
- if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
+ if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
int kval = atoi(argv[0]);
switch_bind_flag_t bind_flags = 0;
@@ -283,7 +283,7 @@
char *uuid;
switch_bool_t bleg = SWITCH_FALSE;
- if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
+ if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
if (!strcasecmp(argv[0], "-bleg")) {
if (argv[1]) {
@@ -327,7 +327,7 @@
#define eavesdrop_SYNTAX "[all | <uuid>]"
SWITCH_STANDARD_APP(eavesdrop_function)
{
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", eavesdrop_SYNTAX);
} else {
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -401,7 +401,7 @@
#define threeway_SYNTAX "<uuid>"
SWITCH_STANDARD_APP(three_way_function)
{
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", threeway_SYNTAX);
} else {
switch_ivr_eavesdrop_session(session, data, NULL, ED_MUX_READ | ED_MUX_WRITE);
@@ -458,7 +458,7 @@
char *mydata;
switch_call_cause_t cause = SWITCH_CAUSE_CALL_REJECTED;
- if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
+ if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) > 1) {
if (!switch_check_network_list_ip(argv[0], argv[1])) {
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -486,7 +486,7 @@
int bleg = 0, both = 0;
- if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
+ if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
bleg = !strcasecmp(argv[0], "-bleg");
both = !strcasecmp(argv[0], "-both");
@@ -521,7 +521,7 @@
char *argv[4] = { 0 };
char *mydata;
- if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
+ if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) {
time_t when;
@@ -544,7 +544,7 @@
char *argv[5] = { 0 };
char *mydata;
- if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
+ if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
time_t when;
switch_call_cause_t cause = SWITCH_CAUSE_ALLOTTED_TIMEOUT;
@@ -577,7 +577,7 @@
char *argv[6] = { 0 };
char *mydata;
- if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
+ if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) {
time_t when;
switch_media_flag_t flags = SMF_NONE;
@@ -611,7 +611,7 @@
{
uint32_t len = 0;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
len = 1000;
} else {
len = atoi(data);
@@ -630,7 +630,7 @@
{
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
cause = switch_channel_str2cause(data);
}
@@ -640,7 +640,7 @@
SWITCH_STANDARD_APP(set_name_function)
{
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
switch_channel_set_name(switch_core_session_get_channel(session), (char *) data);
}
}
@@ -660,7 +660,7 @@
char *mydata = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
- if (switch_strlen_zero(data) || !(mydata = switch_core_session_strdup(session, data))) {
+ if (zstr(data) || !(mydata = switch_core_session_strdup(session, data))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID ARGS!\n");
return;
}
@@ -703,6 +703,17 @@
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 };
@@ -729,7 +740,7 @@
{
char *var, *val = NULL;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
} else {
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -740,7 +751,7 @@
if (val) {
*val++ = '\0';
- if (switch_strlen_zero(val)) {
+ if (zstr(val)) {
val = NULL;
}
}
@@ -762,7 +773,7 @@
{
char *var, *val = NULL;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
} else {
var = strdup(data);
@@ -771,7 +782,7 @@
if (val) {
*val++ = '\0';
- if (switch_strlen_zero(val)) {
+ if (zstr(val)) {
val = NULL;
}
}
@@ -784,12 +795,9 @@
SWITCH_STANDARD_APP(set_profile_var_function)
{
- switch_caller_profile_t *caller_profile;
char *name, *val = NULL;
- caller_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(session));
-
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
} else {
name = switch_core_session_strdup(session, data);
@@ -797,64 +805,12 @@
if (val) {
*val++ = '\0';
- if (switch_strlen_zero(val)) {
+ if (zstr(val)) {
val = NULL;
}
}
-
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "SET_PROFILE_VAR [%s]=[%s]\n", name, val ? val : "UNDEF");
-
- if (!strcasecmp(name, "dialplan")) {
- caller_profile->dialplan = val;
- }
- if (!strcasecmp(name, "username")) {
- caller_profile->username = val;
- }
- if (!strcasecmp(name, "caller_id_name")) {
- caller_profile->caller_id_name = val;
- }
- if (!strcasecmp(name, "caller_id_number")) {
- caller_profile->caller_id_number = val;
- }
- if (val && !strcasecmp(name, "caller_ton")) {
- caller_profile->caller_ton = (uint8_t) atoi(val);
- }
- if (val && !strcasecmp(name, "caller_numplan")) {
- caller_profile->caller_numplan = (uint8_t) atoi(val);
- }
- if (val && !strcasecmp(name, "destination_number_ton")) {
- caller_profile->destination_number_ton = (uint8_t) atoi(val);
- }
- if (val && !strcasecmp(name, "destination_number_numplan")) {
- caller_profile->destination_number_numplan = (uint8_t) atoi(val);
- }
- if (!strcasecmp(name, "ani")) {
- caller_profile->ani = val;
- }
- if (!strcasecmp(name, "aniii")) {
- caller_profile->aniii = val;
- }
- if (!strcasecmp(name, "network_addr")) {
- caller_profile->network_addr = val;
- }
- if (!strcasecmp(name, "rdnis")) {
- caller_profile->rdnis = val;
- }
- if (!strcasecmp(name, "destination_number")) {
- caller_profile->destination_number = val;
- }
- if (!strcasecmp(name, "uuid")) {
- caller_profile->uuid = val;
- }
- if (!strcasecmp(name, "source")) {
- caller_profile->source = val;
- }
- if (!strcasecmp(name, "context")) {
- caller_profile->context = val;
- }
- if (!strcasecmp(name, "chan_name")) {
- caller_profile->chan_name = val;
- }
+
+ switch_channel_set_profile_var(switch_core_session_get_channel(session), name, val);
}
}
@@ -865,7 +821,7 @@
char *new_exports = NULL, *new_exports_d = NULL, *var, *val = NULL, *var_name = NULL;
int local = 1;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
} else {
exports = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE);
@@ -882,7 +838,7 @@
if (val) {
*val++ = '\0';
- if (switch_strlen_zero(val)) {
+ if (zstr(val)) {
val = NULL;
}
}
@@ -908,7 +864,7 @@
SWITCH_STANDARD_APP(unset_function)
{
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "UNSET [%s]\n", (char *) data);
@@ -944,7 +900,7 @@
char *buf;
int level = SWITCH_LOG_INFO;
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
level = switch_log_str2level(data);
}
@@ -971,7 +927,7 @@
char *lbuf;
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_APPLICATION) == SWITCH_STATUS_SUCCESS) {
- if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
+ if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
int x = 0;
@@ -1021,7 +977,7 @@
{
switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(session));
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No privacy mode specified.\n");
} else {
switch_set_flag(caller_profile, SWITCH_CPF_SCREEN);
@@ -1051,7 +1007,7 @@
int argc;
char *lbuf;
- if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
+ if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, '=', argv, (sizeof(argv) / sizeof(argv[0])))) > 1) {
switch_size_t retsize;
switch_time_exp_t tm;
@@ -1068,7 +1024,7 @@
{
switch_time_t out;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
out = switch_micro_time_now();
} else {
out = switch_str_time(cmd);
@@ -1086,14 +1042,14 @@
char date[80] = "";
switch_time_t thetime;
char *p;
- if (!switch_strlen_zero(cmd) && (p = strchr(cmd, '|'))) {
+ if (!zstr(cmd) && (p = strchr(cmd, '|'))) {
thetime = switch_time_make(atoi(cmd), 0);
cmd = p + 1;
} else {
thetime = switch_micro_time_now();
}
switch_time_exp_lt(&tm, thetime);
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
} else {
switch_strftime(date, &retsize, sizeof(date), cmd, &tm);
@@ -1113,7 +1069,7 @@
switch_event_types_t type = SWITCH_EVENT_PRESENCE_IN;
int need = 4;
- if (!switch_strlen_zero(cmd) && (lbuf = strdup(cmd))
+ if (!zstr(cmd) && (lbuf = strdup(cmd))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) > 0) {
if (!strcasecmp(argv[0], "out")) {
@@ -1166,11 +1122,11 @@
char *lbuf = NULL, *argv[5];
int argc = 0;
- if (!switch_strlen_zero(cmd) && (lbuf = strdup(cmd))
+ 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],
- !switch_strlen_zero(argv[4]) ? argv[4] : NULL , "") == SWITCH_STATUS_SUCCESS) {
+ !zstr(argv[4]) ? argv[4] : NULL , "") == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "Sent");
} else {
stream->write_function(stream, "Error! Message Not Sent");
@@ -1261,7 +1217,7 @@
{
switch_bool_t do_read = SWITCH_TRUE;
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
if (!strcasecmp(data, "write")) {
do_read = SWITCH_FALSE;
}
@@ -1295,7 +1251,7 @@
time_t to = 0;
int hits = 1;
- if (switch_strlen_zero(data) || !(mydata = switch_core_session_strdup(session, data))) {
+ if (zstr(data) || !(mydata = switch_core_session_strdup(session, data))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID ARGS!\n");
return;
}
@@ -1417,7 +1373,7 @@
{
switch_channel_t *channel = switch_core_session_get_channel(session);
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No timeout specified.\n");
} else {
uint32_t ms = atoi(data);
@@ -1452,7 +1408,7 @@
char *mydata = NULL;
switch_input_args_t args = { 0 };
- if (switch_strlen_zero(data) || !(mydata = switch_core_session_strdup(session, data))) {
+ if (zstr(data) || !(mydata = switch_core_session_strdup(session, data))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Params!\n");
return;
}
@@ -1519,6 +1475,11 @@
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
+ if (dtmf->digit == '*') {
+ switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+ return SWITCH_STATUS_FALSE;
+ }
+
if (dtmf->digit == '#') {
switch_channel_hangup(peer_channel, SWITCH_CAUSE_NORMAL_CLEARING);
return SWITCH_STATUS_FALSE;
@@ -1528,7 +1489,7 @@
switch_caller_extension_t *extension = NULL;
const char *app = "three_way";
const char *app_arg = switch_core_session_get_uuid(session);
- const char *holding = switch_channel_get_variable(channel, SWITCH_HOLDING_UUID_VARIABLE);
+ const char *holding = switch_channel_get_variable(channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE);
switch_core_session_t *b_session;
if (holding && (b_session = switch_core_session_locate(holding))) {
@@ -1584,12 +1545,10 @@
SWITCH_STANDARD_APP(att_xfer_function)
{
- const char *var;
switch_core_session_t *peer_session = NULL;
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
switch_channel_t *channel, *peer_channel = NULL;
const char *bond = NULL;
- int timelimit = 60;
switch_core_session_t *b_session = NULL;
channel = switch_core_session_get_channel(session);
@@ -1598,14 +1557,10 @@
bond = switch_core_session_strdup(session, bond);
}
- switch_channel_set_variable(channel, SWITCH_HOLDING_UUID_VARIABLE, bond);
+ switch_channel_set_variable(channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE, bond);
+ switch_channel_set_flag(channel, CF_XFER_ZOMBIE);
-
- if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
- timelimit = atoi(var);
- }
-
- if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL, NULL, SOF_NONE)
+ if (switch_ivr_originate(session, &peer_session, &cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE)
!= SWITCH_STATUS_SUCCESS || !peer_session) {
goto end;
}
@@ -1649,7 +1604,8 @@
switch_core_session_rwunlock(peer_session);
end:
- switch_channel_set_variable(channel, SWITCH_HOLDING_UUID_VARIABLE, NULL);
+ switch_channel_set_variable(channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE, NULL);
+ switch_channel_clear_flag(channel, CF_XFER_ZOMBIE);
}
SWITCH_STANDARD_APP(read_function)
@@ -1665,7 +1621,7 @@
const char *var_name = NULL;
const char *valid_terminators = NULL;
- if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
+ if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No arguments specified.\n");
@@ -1706,7 +1662,7 @@
timeout = 1000;
}
- if (switch_strlen_zero(valid_terminators)) {
+ if (zstr(valid_terminators)) {
valid_terminators = "#";
}
@@ -1729,7 +1685,7 @@
const char *valid_terminators = NULL;
const char *digits_regex = NULL;
- if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
+ if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No arguments specified.\n");
@@ -1782,7 +1738,7 @@
timeout = 1000;
}
- if (switch_strlen_zero(valid_terminators)) {
+ if (zstr(valid_terminators)) {
valid_terminators = "#";
}
@@ -1799,7 +1755,7 @@
switch_input_args_t args = { 0 };
switch_channel_t *channel = switch_core_session_get_channel(session);
- if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
+ 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;
@@ -1821,7 +1777,7 @@
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_status_t status;
- if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
+ if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
const char *lang;
char *macro = mydata;
char *mdata = NULL;
@@ -1901,6 +1857,37 @@
}
+
+
+SWITCH_STANDARD_APP(endless_playback_function)
+{
+ 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)) {
+ status = switch_ivr_play_file(session, NULL, file, NULL);
+
+ if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
+ break;
+ }
+ }
+
+ switch (status) {
+ case SWITCH_STATUS_SUCCESS:
+ case SWITCH_STATUS_BREAK:
+ switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "FILE PLAYED");
+ break;
+ case SWITCH_STATUS_NOTFOUND:
+ switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "FILE NOT FOUND");
+ break;
+ default:
+ switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "PLAYBACK ERROR");
+ break;
+ }
+
+}
+
SWITCH_STANDARD_APP(gentones_function)
{
char *tone_script = NULL;
@@ -1909,7 +1896,7 @@
int32_t loops = 0;
switch_channel_t *channel = switch_core_session_get_channel(session);
- if (switch_strlen_zero(data) || !(tone_script = switch_core_session_strdup(session, data))) {
+ if (zstr(data) || !(tone_script = switch_core_session_strdup(session, data))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Params!\n");
return;
}
@@ -1939,13 +1926,13 @@
char *lbuf = NULL;
char *flags = NULL;
- if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
+ if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
path = argv[0];
for (x = 1; x < argc; x++) {
if (strchr(argv[x], '+')) {
limit = atoi(argv[x]);
- } else if (!switch_strlen_zero(argv[x])) {
+ } else if (!zstr(argv[x])) {
flags = argv[x];
}
}
@@ -1972,7 +1959,7 @@
const char *tmp;
int rate;
- if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
+ if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No file specified.\n");
@@ -2037,7 +2024,7 @@
char *path_end;
uint32_t limit = 0;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
return;
}
@@ -2078,48 +2065,228 @@
/* Bridge Functions */
/********************************************************************************/
+static switch_status_t camp_fire(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;
+ char *key = (char *) buf;
+
+ if (dtmf->digit == *key) {
+ return SWITCH_STATUS_BREAK;
+ }
+ }
+ default:
+ break;
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+struct camping_stake {
+ switch_core_session_t *session;
+ int running;
+ int do_xfer;
+ const char *moh;
+};
+
+static void *SWITCH_THREAD_FUNC camp_music_thread(switch_thread_t *thread, void *obj)
+{
+ struct camping_stake *stake = (struct camping_stake *) obj;
+ switch_core_session_t *session = stake->session;
+ switch_channel_t *channel = switch_core_session_get_channel(stake->session);
+ const char *moh = stake->moh, *greet = NULL;
+ switch_input_args_t args = { 0 };
+ char dbuf[2] = "";
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ const char *stop;
+
+ if ((stop = switch_channel_get_variable(channel, "campon_stop_key"))) {
+ *dbuf = *stop;
+ }
+
+ 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)) {
+ if (status != SWITCH_STATUS_BREAK) {
+ if (!strcasecmp(moh, "silence")) {
+ status = switch_ivr_collect_digits_callback(session, &args, 0, 0);
+ } else {
+ status = switch_ivr_play_file(session, NULL, stake->moh, &args);
+ }
+ }
+
+ if (status == SWITCH_STATUS_BREAK) {
+ switch_channel_set_flag(channel, CF_NOT_READY);
+ stake->do_xfer = 1;
+ }
+ }
+ switch_core_session_rwunlock(session);
+
+ stake->running = 0;
+ return NULL;
+}
+
SWITCH_STANDARD_APP(audio_bridge_function)
{
switch_channel_t *caller_channel = switch_core_session_get_channel(session);
switch_core_session_t *peer_session = NULL;
- unsigned int timelimit = 60;
- const char *var, *continue_on_fail = NULL, *failure_causes = NULL;
+ const char *continue_on_fail = NULL, *failure_causes = NULL,
+ *v_campon = NULL, *v_campon_retries, *v_campon_sleep, *v_campon_timeout, *v_campon_fallback_exten = NULL;
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
-
- if (switch_strlen_zero(data)) {
+ int campon_retries = 100, campon_timeout = 10, campon_sleep = 10, tmp, camping = 0, fail = 0, thread_started = 0;
+ struct camping_stake stake = { 0 };
+ const char *moh = NULL;
+ switch_thread_t *thread = NULL;
+ switch_threadattr_t *thd_attr = NULL;
+ char *camp_data = NULL;
+ switch_status_t status;
+
+ if (zstr(data)) {
return;
}
- if ((var = switch_channel_get_variable(caller_channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
- timelimit = atoi(var);
- }
-
continue_on_fail = switch_channel_get_variable(caller_channel, "continue_on_fail");
failure_causes = switch_channel_get_variable(caller_channel, "failure_causes");
- if ((var = switch_channel_get_variable(caller_channel, SWITCH_PROXY_MEDIA_VARIABLE)) && switch_true(var)) {
- switch_channel_set_flag(caller_channel, CF_PROXY_MEDIA);
- }
+ 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");
+ }
- if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)
- || ((var = switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_VARIABLE)) && switch_true(var))) {
- if (!switch_channel_test_flag(caller_channel, CF_ANSWERED)
- && !switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) {
- switch_channel_set_flag(caller_channel, CF_PROXY_MODE);
+ if (!(cid_number = switch_channel_get_variable(caller_channel, "effective_caller_id_number"))) {
+ cid_number = switch_channel_get_variable(caller_channel, "caller_id_number");
+ }
+
+ if (cid_name && !cid_number) {
+ cid_number = cid_name;
+ }
+
+ if (cid_number && !cid_name) {
+ cid_name = cid_number;
+ }
+
+ v_campon_retries = switch_channel_get_variable(caller_channel, "campon_retries");
+ 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;
+ }
+ }
+
+ if (v_campon_timeout) {
+ if ((tmp = atoi(v_campon_timeout)) > 0) {
+ campon_timeout = tmp;
+ }
+ }
+
+ if (v_campon_sleep) {
+ if ((tmp = atoi(v_campon_sleep)) > 0) {
+ campon_sleep = tmp;
+ }
+ }
+
+ switch_channel_answer(caller_channel);
+ 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",
+ cid_name, cid_number, data);
} 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);
+ camp_data = (char *)data;
+ }
+
+ if (!(moh = switch_channel_get_variable(caller_channel, "hold_music"))) {
+ moh = switch_channel_get_variable(caller_channel, "campon_hold_music");
+ }
+
+ do {
+ fail = 0;
+ status = switch_ivr_originate(NULL, &peer_session, &cause, camp_data, campon_timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE);
+
+ if (!switch_channel_ready(caller_channel)) {
+ fail = 1;
+ break;
+ }
+
+ if (status == SWITCH_STATUS_SUCCESS) {
+ camping = 0;
+ break;
} 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);
+ fail = 1;
}
+
+ if (camping) {
+
+ 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));
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ stake.running = 1;
+ stake.moh = moh;
+ stake.session = session;
+ switch_thread_create(&thread, thd_attr, camp_music_thread, &stake, switch_core_session_get_pool(session));
+ thread_started = 1;
+ }
+
+
+ if (--campon_retries <= 0 || stake.do_xfer) {
+ camping = 0;
+ stake.do_xfer = 1;
+ break;
+ }
+
+ if (fail) {
+ int64_t wait = campon_sleep * 1000000;
+
+ 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);
+ switch_thread_join(&status, thread);
}
+
+ 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_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)) != SWITCH_STATUS_SUCCESS) {
+ fail = 1;
+ }
}
- if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
+ if (fail) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Originate Failed. Cause: %s\n", switch_channel_cause2str(cause));
/*
@@ -2237,11 +2404,11 @@
switch_originate_flag_t myflags = SOF_NONE;
char *cid_name_override = NULL;
char *cid_num_override = NULL;
- const char *var, *skip = NULL;
- unsigned int timelimit = 60;
char *domain = NULL;
switch_channel_t *new_channel = NULL;
-
+ unsigned int timelimit = 60;
+ const char *skip, *var;
+
group = strdup(outbound_profile->destination_number);
if (!group) goto done;
@@ -2359,7 +2526,7 @@
char stupid[128] = "";
const char *skip = NULL, *var = NULL;
- if (switch_strlen_zero(outbound_profile->destination_number)) {
+ if (zstr(outbound_profile->destination_number)) {
goto done;
}
@@ -2590,7 +2757,7 @@
int argc;
char *lbuf = NULL;
- if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
+ 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]);
silence_hits = atoi(argv[1]);
@@ -2667,7 +2834,7 @@
if (proto) {
switch_core_chat_send(proto, "api", to, hint && strchr(hint, '/') ? hint : from,
- !switch_strlen_zero(type) ? type : NULL, (char *) stream.data, NULL, NULL);
+ !zstr(type) ? type : NULL, (char *) stream.data, NULL, NULL);
}
switch_safe_free(stream.data);
@@ -2765,6 +2932,8 @@
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);
@@ -2808,6 +2977,8 @@
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",
+ 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",
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_easyroute/mod_easyroute.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_easyroute/mod_easyroute.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_easyroute/mod_easyroute.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -125,13 +125,13 @@
}
done:
- if (switch_strlen_zero(globals.db_username)) {
+ if (zstr(globals.db_username)) {
set_global_db_username("root");
}
- if (switch_strlen_zero(globals.db_password)) {
+ if (zstr(globals.db_password)) {
set_global_db_password("password");
}
- if (switch_strlen_zero(globals.db_dsn)) {
+ if (zstr(globals.db_dsn)) {
set_global_db_dsn("easyroute");
}
@@ -208,25 +208,25 @@
char tmp_profile[129];
char tmp_gateway[129];
- if (switch_strlen_zero(pdata.limit)) {
+ if (zstr(pdata.limit)) {
switch_set_string(results->limit, "9999" );
} else {
switch_set_string(results->limit, pdata.limit );
}
- if (switch_strlen_zero(pdata.techprofile)){
+ if (zstr(pdata.techprofile)){
switch_set_string(tmp_profile, globals.default_techprofile);
} else {
switch_set_string(tmp_profile, pdata.techprofile);
}
- if (switch_strlen_zero(pdata.gateway)){
+ if (zstr(pdata.gateway)){
switch_set_string(tmp_gateway, globals.default_gateway);
} else {
switch_set_string(tmp_gateway, pdata.gateway);
}
- if (switch_strlen_zero(pdata.translated)){
+ if (zstr(pdata.translated)){
switch_set_string(results->translated, dn);
} else {
switch_set_string(results->translated, pdata.translated);
@@ -240,13 +240,13 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "THE ROUTE [%s]\n", results->dialstring);
- if (switch_strlen_zero(pdata.group)){
+ if (zstr(pdata.group)){
switch_set_string(results->group, "");
} else {
switch_set_string(results->group, pdata.group);
}
- if (switch_strlen_zero(pdata.acctcode)){
+ if (zstr(pdata.acctcode)){
switch_set_string(results->acctcode, "");
} else {
switch_set_string(results->acctcode, pdata.acctcode);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_enum/mod_enum.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_enum/mod_enum.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_enum/mod_enum.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -471,7 +471,7 @@
root = mroot;
}
- if (switch_strlen_zero(root)) {
+ if (zstr(root)) {
root = globals.root;
}
@@ -675,7 +675,7 @@
char *last_delim = "|";
int ok = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", "none");
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_esf/mod_esf.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_esf/mod_esf.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_esf/mod_esf.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -83,7 +83,7 @@
switch_core_session_get_read_impl(session, &read_impl);
- if (!switch_strlen_zero((char *) data)) {
+ if (!zstr((char *) data)) {
mydata = switch_core_session_strdup(session, data);
assert(mydata != NULL);
@@ -93,20 +93,20 @@
mcast_ip = switch_core_session_strdup(session, var);
}
- if (!switch_strlen_zero(argv[0])) {
+ if (!zstr(argv[0])) {
mcast_ip = argv[0];
}
- if (!switch_strlen_zero(argv[1])) {
+ if (!zstr(argv[1])) {
mcast_port_str = argv[1];
mcast_port = (switch_port_t) atoi(mcast_port_str);
}
- if (!switch_strlen_zero(argv[2])) {
+ if (!zstr(argv[2])) {
mcast_control_port = (switch_port_t) atoi(argv[2]);
}
- if (!switch_strlen_zero(argv[3])) {
+ if (!zstr(argv[3])) {
mcast_ttl = atoi(argv[3]);
if (mcast_ttl < 1 || mcast_ttl > 255) {
mcast_ttl = 1;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_expr/mod_expr.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_expr/mod_expr.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_expr/mod_expr.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -54,7 +54,7 @@
size_t len;
int ec = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto error;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_fax/mod_fax.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_fax/mod_fax.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_fax/mod_fax.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -133,7 +133,7 @@
break;
}
- if (!switch_strlen_zero(msg)) {
+ if (!zstr(msg)) {
switch_log_printf(SWITCH_CHANNEL_LOG, fs_log_level, "%s", msg);
}
}
@@ -511,7 +511,7 @@
}
}
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
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)) {
@@ -706,11 +706,11 @@
const char *name = switch_xml_attr(x_list, "name");
const char *value = switch_xml_attr(x_list, "value");
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
continue;
}
- if (switch_strlen_zero(value)) {
+ if (zstr(value)) {
continue;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_fifo/mod_fifo.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_fifo/mod_fifo.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_fifo/mod_fifo.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -59,6 +59,23 @@
typedef struct fifo_node fifo_node_t;
+struct callback {
+ char *buf;
+ size_t len;
+ int matches;
+};
+typedef struct callback callback_t;
+
+static int sql2str_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+ callback_t *cbt = (callback_t *) pArg;
+
+ switch_copy_string(cbt->buf, argv[0], cbt->len);
+ cbt->matches++;
+ return 0;
+}
+
+
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
{
switch_core_session_t *bleg = (switch_core_session_t *) buf;
@@ -72,7 +89,7 @@
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_ORIGINATOR)) {
+ if (switch_channel_test_flag(switch_core_session_get_channel(session), CF_BRIDGE_ORIGINATOR)) {
if ( consumer_exit_key && dtmf->digit == *consumer_exit_key ) {
switch_channel_hangup(bchan, SWITCH_CAUSE_NORMAL_CLEARING);
return SWITCH_STATUS_BREAK;
@@ -129,7 +146,7 @@
return SWITCH_STATUS_SUCCESS;
}
-#define check_string(s) if (!switch_strlen_zero(s) && !strcasecmp(s, "undef")) { s = NULL; }
+#define check_string(s) if (!zstr(s) && !strcasecmp(s, "undef")) { s = NULL; }
static int node_consumer_wait_count(fifo_node_t *node)
{
@@ -280,7 +297,7 @@
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 (!switch_strlen_zero(err_str)) {
+ 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);
@@ -349,11 +366,14 @@
return ret;
}
-static fifo_node_t *create_node(const char *name, uint32_t importance)
+static fifo_node_t *create_node(const char *name, uint32_t importance, switch_mutex_t *mutex)
{
fifo_node_t *node;
int x = 0;
switch_memory_pool_t *pool;
+ char outbound_count[80] = "";
+ callback_t cbt = { 0 };
+ char *sql = NULL;
if (!globals.running) {
return NULL;
@@ -373,7 +393,17 @@
switch_core_hash_init(&node->consumer_hash, node->pool);
switch_thread_rwlock_create(&node->rwlock, node->pool);
switch_mutex_init(&node->mutex, SWITCH_MUTEX_NESTED, node->pool);
+ cbt.buf = outbound_count;
+ cbt.len = sizeof(outbound_count);
+ sql = switch_mprintf("select count(*) from fifo_outbound where fifo_name = '%q'", name);
+ fifo_execute_sql_callback(mutex, sql, sql2str_callback, &cbt);
+ if (atoi(outbound_count) > 0) {
+ node->has_outbound = 1;
+ }
+ switch_safe_free(sql);
+
node->importance = importance;
+
switch_mutex_lock(globals.mutex);
switch_core_hash_insert(globals.fifo_hash, name, node);
switch_mutex_unlock(globals.mutex);
@@ -560,20 +590,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) && node->has_outbound && node->ready) {
+ 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\n", node->name, ppl_waiting, consumer_total, idle_consumers, node->ring_consumer_count);
+ /* 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(globals.mutex);
@@ -678,7 +710,8 @@
switch_mutex_lock(globals.mutex);
if (!(node = switch_core_hash_find(globals.fifo_hash, node_name))) {
- node = create_node(node_name, 0);
+ node = create_node(node_name, 0, globals.sql_mutex);
+ node->ready = 1;
}
send_presence(node);
@@ -700,7 +733,7 @@
switch_mutex_lock(globals.mutex);
if (!(node = switch_core_hash_find(globals.fifo_hash, node_name))) {
- node = create_node(node_name, 0);
+ node = create_node(node_name, 0, globals.sql_mutex);
}
switch_mutex_unlock(globals.mutex);
@@ -719,7 +752,7 @@
int argc;
uint32_t priority = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto fail;
}
@@ -786,7 +819,7 @@
return;
}
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No Args\n");
return;
}
@@ -839,7 +872,8 @@
if (!(node = switch_core_hash_find(globals.fifo_hash, nlist[i]))) {
- node = create_node(nlist[i], importance);
+ node = create_node(nlist[i], importance, globals.sql_mutex);
+ node->ready = 1;
}
node_list[node_count++] = node;
}
@@ -1105,7 +1139,7 @@
fifo_strategy_t strat = STRAT_WAITING_LONGER;
char *url = NULL;
- if (!switch_strlen_zero(strat_str)) {
+ if (!zstr(strat_str)) {
if (!strcasecmp(strat_str, "more_ppl")) {
strat = STRAT_MORE_PPL;
} else if (!strcasecmp(strat_str, "waiting_longer")) {
@@ -1455,7 +1489,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 (!switch_strlen_zero(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;
@@ -1463,7 +1497,7 @@
memset(buf, 0, sizeof(buf));
- if (fifo_consumer_wrapup_time || !switch_strlen_zero(fifo_consumer_wrapup_key)) {
+ if (fifo_consumer_wrapup_time || !zstr(fifo_consumer_wrapup_key)) {
switch_channel_set_variable(channel, "fifo_status", "WRAPUP");
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
@@ -1473,7 +1507,7 @@
}
}
- if (!switch_strlen_zero(fifo_consumer_wrapup_sound)) {
+ if (!zstr(fifo_consumer_wrapup_sound)) {
memset(&args, 0, sizeof(args));
args.buf = buf;
args.buflen = sizeof(buf);
@@ -1484,7 +1518,7 @@
wrapup_time_started = switch_micro_time_now();
}
- if (!switch_strlen_zero(fifo_consumer_wrapup_key) && strcmp(buf, fifo_consumer_wrapup_key)) {
+ if (!zstr(fifo_consumer_wrapup_key) && strcmp(buf, fifo_consumer_wrapup_key)) {
while(switch_channel_ready(channel)) {
char terminator = 0;
@@ -1503,7 +1537,7 @@
}
}
- } else if (fifo_consumer_wrapup_time && (switch_strlen_zero(fifo_consumer_wrapup_key) || !strcmp(buf, fifo_consumer_wrapup_key))) {
+ } else if (fifo_consumer_wrapup_time && (zstr(fifo_consumer_wrapup_key) || !strcmp(buf, fifo_consumer_wrapup_key))) {
while(switch_channel_ready(channel)) {
wrapup_time_elapsed = (switch_micro_time_now() - wrapup_time_started) / 1000;
if (wrapup_time_elapsed > fifo_consumer_wrapup_time) {
@@ -1727,12 +1761,12 @@
return SWITCH_STATUS_FALSE;
}
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
data = strdup(cmd);
switch_assert(data);
}
- if (switch_strlen_zero(cmd) || (argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1 || !argv[0]) {
+ if (zstr(cmd) || (argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1 || !argv[0]) {
stream->write_function(stream, "%s\n", FIFO_API_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1846,6 +1880,7 @@
switch_core_db_t *db;
switch_status_t status = SWITCH_STATUS_SUCCESS;
char *sql;
+ switch_bool_t delete_all_outbound_member_on_startup = SWITCH_FALSE;
gethostname(globals.hostname, sizeof(globals.hostname));
@@ -1862,7 +1897,7 @@
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
- if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
+ 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, ':'))) {
@@ -1874,12 +1909,13 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
}
+ } else if (!strcasecmp(var, "delete-all-outbound-member-on-startup")) {
+ delete_all_outbound_member_on_startup = switch_true(val);
}
}
}
-
- if (switch_strlen_zero(globals.odbc_dsn) || switch_strlen_zero(odbc_user) || switch_strlen_zero(odbc_pass)) {
+ if (zstr(globals.odbc_dsn) || zstr(odbc_user) || zstr(odbc_pass)) {
globals.dbname = "fifo";
}
@@ -1903,7 +1939,7 @@
}
} else {
if ((db = switch_core_db_open_file(globals.dbname))) {
- switch_core_db_test_reactive(db, "delete from fifo_outbound", NULL, (char *)outbound_sql);
+ 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;
@@ -1926,7 +1962,7 @@
switch_mutex_unlock(globals.mutex);
}
- if (del_all) {
+ 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);
@@ -1962,7 +1998,7 @@
switch_mutex_lock(globals.mutex);
if (!(node = switch_core_hash_find(globals.fifo_hash, name))) {
- node = create_node(name, imp);
+ node = create_node(name, imp, globals.sql_mutex);
}
switch_mutex_unlock(globals.mutex);
@@ -1999,16 +2035,27 @@
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, "
+ "next_avail, expires, static, outbound_call_count, outbound_fail_count, hostname) "
+ "values ('%q','%q',"
+ "'{execute_on_answer=''unset fifo_hangup_check'',fifo_hangup_check=''%q''"
+ "}%q',%d,%d,%d,%d,0,0,1,0,0,'%q')",
+ digest, node->name, node->name, member->txt, simo_i, 0, timeout_i, lag_i, globals.hostname);
+ } else {
- sql = switch_mprintf("insert into fifo_outbound "
- "(uuid, fifo_name, originate_string, simo_count, use_count, timeout, lag, "
- "next_avail, expires, static, outbound_call_count, outbound_fail_count, hostname) "
- "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,0,0,1,0,0,'%q')",
-
- digest, node->name, node->name, name_dup, member->txt, simo_i, 0, timeout_i, lag_i, globals.hostname
- );
+ sql = switch_mprintf("insert into fifo_outbound "
+ "(uuid, fifo_name, originate_string, simo_count, use_count, timeout, lag, "
+ "next_avail, expires, static, outbound_call_count, outbound_fail_count, hostname) "
+ "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,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);
fifo_execute_sql(sql, globals.sql_mutex);
free(sql);
@@ -2086,7 +2133,8 @@
switch_mutex_lock(globals.mutex);
if (!(node = switch_core_hash_find(globals.fifo_hash, fifo_name))) {
- node = create_node(fifo_name, 0);
+ node = create_node(fifo_name, 0, globals.sql_mutex);
+ node->ready = 1;
}
switch_mutex_unlock(globals.mutex);
@@ -2142,7 +2190,7 @@
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(cmd)){
+ if (zstr(cmd)){
stream->write_function(stream, "-USAGE: %s\n", FIFO_MEMBER_API_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -2206,6 +2254,7 @@
{
switch_application_interface_t *app_interface;
switch_api_interface_t *commands_api_interface;
+ switch_status_t status;
/* create/register custom event message type */
if (switch_event_reserve_subclass(FIFO_EVENT) != SWITCH_STATUS_SUCCESS) {
@@ -2224,6 +2273,16 @@
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) {
+ switch_event_unbind(&globals.node);
+ switch_event_free_subclass(FIFO_EVENT);
+ switch_core_hash_destroy(&globals.fifo_hash);
+ switch_core_destroy_memory_pool(&globals.pool);
+ return status;
+ }
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@@ -2236,9 +2295,6 @@
switch_console_set_complete("add fifo count");
switch_console_set_complete("add fifo importance");
- globals.running = 1;
-
- load_config(0,1);
start_node_thread(globals.pool);
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_lcr/mod_lcr.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_lcr/mod_lcr.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_lcr/mod_lcr.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -36,6 +36,8 @@
#define LCR_ADMIN_SYNTAX "lcr_admin show profiles"
/* SQL Query places */
+/* these now make up a map that describes the location of
+ the field based on name */
#define LCR_DIGITS_PLACE 0
#define LCR_CARRIER_PLACE 1
#define LCR_RATE_PLACE 2
@@ -47,9 +49,10 @@
#define LCR_SUFFIX_PLACE 8
#define LCR_CODEC_PLACE 9
#define LCR_CID_PLACE 10
+#define LCR_USER_RATE_PLACE 11
#define LCR_QUERY_COLS_REQUIRED 9
-#define LCR_QUERY_COLS 11
+#define LCR_QUERY_COLS 12
#define LCR_HEADERS_COUNT 6
@@ -83,6 +86,8 @@
char *dialstring;
float rate;
char *rate_str;
+ float user_rate;
+ char *user_rate_str;
size_t lstrip;
size_t tstrip;
size_t digit_len;
@@ -169,7 +174,7 @@
char *dst_regex = NULL;
switch_channel_t *channel = NULL;
- if (!switch_strlen_zero(cid)) {
+ if (!zstr(cid)) {
len = strlen(cid);
} else {
goto done;
@@ -246,6 +251,7 @@
char *codec = NULL;
char *cid = NULL;
char *header = NULL;
+ char *user_rate = NULL;
orig_destination_number = destination_number = switch_core_strdup(pool, dialed_number);
@@ -269,12 +275,12 @@
}
}
codec = "";
- if (!switch_strlen_zero(cur_route->codec)) {
+ if (!zstr(cur_route->codec)) {
codec = switch_core_sprintf(pool, ",absolute_codec_string=%s", cur_route->codec);
}
cid = "";
- if (!switch_strlen_zero(cur_route->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));
}
@@ -286,9 +292,15 @@
cur_route->carrier_name);
}
- data = switch_core_sprintf(pool, "[lcr_carrier=%s,lcr_rate=%s%s%s%s]%s%s%s%s%s"
+ 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
- , codec, cid, header
+ , user_rate, codec, cid, header
, cur_route->gw_prefix, cur_route->prefix
, destination_number, cur_route->suffix, cur_route->gw_suffix);
@@ -300,7 +312,7 @@
{
profile_t *profile = NULL;
- if (switch_strlen_zero(profile_name)) {
+ 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);
@@ -543,7 +555,7 @@
return SWITCH_STATUS_GENERR;
}
- if (switch_strlen_zero(argv[LCR_GW_PREFIX_PLACE]) && switch_strlen_zero(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]),
@@ -571,6 +583,10 @@
if (argc > LCR_CID_PLACE) {
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_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);
if (cbt->head == NULL) {
@@ -716,11 +732,12 @@
char *id_str;
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 (switch_strlen_zero(digits_copy)) {
+ if (zstr(digits_copy)) {
return SWITCH_STATUS_GENERR;
}
@@ -739,10 +756,13 @@
/* 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");
+ user_rate_field = switch_core_strdup(cb_struct->pool, "user_intralata_rate");
} else if (cb_struct->intrastate == SWITCH_TRUE && profile->profile_has_intrastate == SWITCH_TRUE) {
rate_field = switch_core_strdup(cb_struct->pool, "intrastate_rate");
+ user_rate_field = switch_core_strdup(cb_struct->pool, "user_intrastate_rate");
} else {
rate_field = switch_core_strdup(cb_struct->pool, "rate");
+ user_rate_field = switch_core_strdup(cb_struct->pool, "user_rate");
}
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);
@@ -752,6 +772,7 @@
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "we have a session\n");
if ((channel = switch_core_session_get_channel(cb_struct->session))) {
switch_channel_set_variable_var_check(channel, "lcr_rate_field", rate_field, SWITCH_FALSE);
+ switch_channel_set_variable_var_check(channel, "lcr_user_rate_field", user_rate_field, SWITCH_FALSE);
switch_channel_set_variable_var_check(channel, "lcr_query_digits", digits_copy, SWITCH_FALSE);
id_str = switch_core_sprintf(cb_struct->pool, "%d", cb_struct->profile->id);
switch_channel_set_variable_var_check(channel, "lcr_query_profile", id_str, SWITCH_FALSE);
@@ -761,6 +782,7 @@
if (cb_struct->event) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "we have an event\n");
switch_event_add_header_string(cb_struct->event, SWITCH_STACK_BOTTOM, "lcr_rate_field", rate_field);
+ switch_event_add_header_string(cb_struct->event, SWITCH_STACK_BOTTOM, "lcr_user_rate_field", user_rate_field);
switch_event_add_header_string(cb_struct->event, SWITCH_STACK_BOTTOM, "lcr_query_digits", digits_copy);
id_str = switch_core_sprintf(cb_struct->pool, "%d", cb_struct->profile->id);
switch_event_add_header_string(cb_struct->event, SWITCH_STACK_BOTTOM, "lcr_query_profile", id_str);
@@ -840,7 +862,7 @@
char *val = NULL;
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
- if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
+ if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "odbc_dsn is %s\n", val);
globals.odbc_dsn = switch_core_strdup(globals.pool, val);
if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
@@ -900,13 +922,13 @@
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
- if (!strcasecmp(var, "order_by") && !switch_strlen_zero(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++) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "arg #%d/%d is %s\n", x, argc, argv[x]);
- if (!switch_strlen_zero(argv[x])) {
+ if (!zstr(argv[x])) {
if (!strcasecmp(argv[x], "quality")) {
thisorder->write_function(thisorder, "%s quality DESC", comma);
} else if (!strcasecmp(argv[x], "reliability")) {
@@ -929,40 +951,40 @@
thisorder->write_function(thisorder, "%s %s", comma, val);
}
}
- } else if (!strcasecmp(var, "id") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "id") && !zstr(val)) {
id_s = val;
- } else if (!strcasecmp(var, "custom_sql") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "custom_sql") && !zstr(val)) {
custom_sql = val;
- } else if (!strcasecmp(var, "reorder_by_rate") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "reorder_by_rate") && !zstr(val)) {
reorder_by_rate = val;
- } else if (!strcasecmp(var, "info_in_headers") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "info_in_headers") && !zstr(val)) {
info_in_headers = val;
- } else if (!strcasecmp(var, "quote_in_list") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "quote_in_list") && !zstr(val)) {
quote_in_list = val;
}
}
- if (switch_strlen_zero(name)) {
+ 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 (!switch_strlen_zero((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 (!switch_strlen_zero(id_s)) {
+ if (!zstr(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 (switch_strlen_zero(custom_sql)) {
+ 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 "
@@ -1024,15 +1046,15 @@
}
profile->custom_sql = switch_core_strdup(globals.pool, (char *)custom_sql);
- if (!switch_strlen_zero(reorder_by_rate)) {
+ if (!zstr(reorder_by_rate)) {
profile->reorder_by_rate = switch_true(reorder_by_rate);
}
- if (!switch_strlen_zero(info_in_headers)) {
+ if (!zstr(info_in_headers)) {
profile->info_in_headers = switch_true(info_in_headers);
}
- if (!switch_strlen_zero(quote_in_list)) {
+ if (!zstr(quote_in_list)) {
profile->quote_in_list = switch_true(quote_in_list);
}
@@ -1102,10 +1124,10 @@
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 (!switch_strlen_zero(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 (!switch_strlen_zero(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 {
@@ -1192,8 +1214,8 @@
intra = switch_channel_get_variable(channel, "intrastate");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "intrastate channel var is [%s]\n",
- switch_strlen_zero(intra) ? "undef" : intra);
- if (switch_strlen_zero(intra) || strcasecmp((char *)intra, "true")) {
+ 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 {
@@ -1221,6 +1243,7 @@
routes.cid = (char *) caller_profile->caller_id_number;
}
}
+
if (!(routes.profile = locate_profile(lcr_profile))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Unknown profile: %s\n", lcr_profile);
@@ -1285,7 +1308,7 @@
switch_bool_t as_xml = SWITCH_FALSE;
int rowcount=0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
@@ -1331,7 +1354,7 @@
}
}
}
- if (switch_strlen_zero(cb_struct.cid)) {
+ 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
@@ -1457,7 +1480,7 @@
void *val;
profile_t *profile;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
@@ -1474,7 +1497,7 @@
profile = (profile_t *) val;
stream->write_function(stream, "Name:\t\t%s\n", profile->name);
- if (switch_strlen_zero(profile->custom_sql)) {
+ if (zstr(profile->custom_sql)) {
stream->write_function(stream, " ID:\t\t%d\n", profile->id);
stream->write_function(stream, " order by:\t%s\n", profile->order_by);
} else {
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_limit/mod_limit.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_limit/mod_limit.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_limit/mod_limit.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -102,7 +102,7 @@
if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
char *err_str;
err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
- if (!switch_strlen_zero(err_str)) {
+ 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);
@@ -199,7 +199,7 @@
}
- if (switch_strlen_zero(globals.odbc_dsn) || switch_strlen_zero(odbc_user) || switch_strlen_zero(odbc_pass)) {
+ if (zstr(globals.odbc_dsn) || zstr(odbc_user) || zstr(odbc_pass)) {
globals.dbname = "call_limit";
}
@@ -447,7 +447,7 @@
switch_mutex_lock(globals.mutex);
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -518,7 +518,7 @@
char *mydata = NULL;
char *sql = NULL;
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -567,7 +567,7 @@
switch_mutex_lock(globals.db_hash_mutex);
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
mydata = strdup(data);
switch_assert(mydata);
argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -621,7 +621,7 @@
switch_mutex_lock(globals.db_hash_mutex);
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -683,7 +683,7 @@
switch_mutex_lock(globals.mutex);
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
mydata = strdup(cmd);
argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -766,7 +766,7 @@
char *mydata = NULL;
char *sql;
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -865,7 +865,7 @@
int max = 0;
switch_channel_t *channel = switch_core_session_get_channel(session);
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -931,7 +931,7 @@
int max = -1;
/* Parse application data */
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -958,7 +958,7 @@
app = argv[3];
app_arg = argv[4];
- if (switch_strlen_zero(app)) {
+ if (zstr(app)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing application\n");
return;
}
@@ -982,7 +982,7 @@
callback_t cbt = { 0 };
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -1158,7 +1158,7 @@
switch_channel_t *channel = switch_core_session_get_channel(session);
/* Parse application data */
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -1223,7 +1223,7 @@
int interval = 0;
/* Parse application data */
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -1258,7 +1258,7 @@
app = argv[3];
app_arg = argv[4];
- if (switch_strlen_zero(app)) {
+ if (zstr(app)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing application\n");
return;
}
@@ -1282,7 +1282,7 @@
switch_mutex_lock(globals.limit_hash_mutex);
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -1495,7 +1495,7 @@
switch_channel_t *channel = switch_core_session_get_channel(session);
/* Parse application data */
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -1556,7 +1556,7 @@
char *szinterval = NULL;
/* Parse application data */
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -1588,7 +1588,7 @@
app = argv[3];
app_arg = argv[4];
- if (switch_strlen_zero(app)) {
+ if (zstr(app)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing application\n");
return;
}
@@ -1619,7 +1619,7 @@
goto end;
}
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_memcache/mod_memcache.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_memcache/mod_memcache.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_memcache/mod_memcache.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -160,7 +160,7 @@
memcached_stat_st *stat = NULL;
memcached_server_st *server_list;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_nibblebill/mod_nibblebill.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_nibblebill/mod_nibblebill.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_nibblebill/mod_nibblebill.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -189,22 +189,22 @@
/* Set defaults for any variables still not set */
setdefaults:
- if (switch_strlen_zero(globals.db_username)) {
+ if (zstr(globals.db_username)) {
set_global_db_username("bandwidth.com");
}
- if (switch_strlen_zero(globals.db_password)) {
+ if (zstr(globals.db_password)) {
set_global_db_password("dev");
}
- if (switch_strlen_zero(globals.db_dsn)) {
+ if (zstr(globals.db_dsn)) {
set_global_db_dsn("bandwidth.com");
}
- if (switch_strlen_zero(globals.percall_action)) {
+ if (zstr(globals.percall_action)) {
set_global_percall_action("hangup");
}
- if (switch_strlen_zero(globals.lowbal_action)) {
+ if (zstr(globals.lowbal_action)) {
set_global_lowbal_action("play ding");
}
- if (switch_strlen_zero(globals.nobal_action)) {
+ if (zstr(globals.nobal_action)) {
set_global_nobal_action("hangup");
}
@@ -722,7 +722,7 @@
char *lbuf = NULL;
char *argv[3] = { 0 };
- if (!switch_strlen_zero(data) && (lbuf = strdup(data))
+ 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]));
@@ -751,9 +751,9 @@
char *mycmd = NULL, *argv[3] = { 0 };
int argc = 0;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
- if ((argc == 2 || argc == 3) && !switch_strlen_zero(argv[0])) {
+ if ((argc == 2 || argc == 3) && !zstr(argv[0])) {
char *uuid = argv[0];
if ((psession = switch_core_session_locate(uuid))) {
switch_channel_t *channel;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_rss/mod_rss.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_rss/mod_rss.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_rss/mod_rss.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -234,7 +234,7 @@
switch_channel_answer(channel);
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
if ((mydata = switch_core_session_strdup(session, data))) {
argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]));
@@ -394,7 +394,7 @@
err = switch_xml_error(xml);
- if (!switch_strlen_zero(err)) {
+ if (!zstr(err)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Error [%s]\n", err);
goto finished;
}
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_snapshot (from rev 15313, freeswitch/trunk/src/mod/applications/mod_snapshot)
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_snapshot/mod_snapshot.2008.vcproj
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_snapshot/mod_snapshot.2008.vcproj (from rev 15313, freeswitch/trunk/src/mod/applications/mod_snapshot/mod_snapshot.2008.vcproj) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_snapshot/mod_snapshot.2008.vcproj (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_snapshot/mod_snapshot.2008.vcproj 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,287 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="mod_snapshot"
+ ProjectGUID="{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}"
+ RootNamespace="mod_snapshot"
+ 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"
+ 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="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"
+ 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"
+ 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"
+ 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"
+ 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_snapshot.c"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_snapshot/mod_snapshot.c
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_snapshot/mod_snapshot.c (from rev 15313, freeswitch/trunk/src/mod/applications/mod_snapshot/mod_snapshot.c) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_snapshot/mod_snapshot.c (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_snapshot/mod_snapshot.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,347 @@
+/*
+ * 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):
+ *
+ * Anthony Minessale II <anthm@freeswitch.org>
+ *
+ *
+ * mod_snapshot.c -- record a sliding window of audio and take snapshots to disk
+ *
+ */
+#include <switch.h>
+
+/* Prototypes */
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_snapshot_runtime);
+SWITCH_MODULE_LOAD_FUNCTION(mod_snapshot_load);
+
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
+ * Defines a switch_loadable_module_function_table_t and a static const char[] modname
+ */
+SWITCH_MODULE_DEFINITION(mod_snapshot, mod_snapshot_load, NULL, NULL);
+
+struct cap_cb {
+ switch_buffer_t *buffer;
+ switch_mutex_t *mutex;
+ char *base;
+};
+
+static switch_bool_t capture_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
+{
+ switch_core_session_t *session = switch_core_media_bug_get_session(bug);
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ struct cap_cb *cb = (struct cap_cb *) user_data;
+
+ switch (type) {
+ case SWITCH_ABC_TYPE_INIT:
+ break;
+ case SWITCH_ABC_TYPE_CLOSE:
+ {
+ if (cb->buffer) {
+ switch_buffer_destroy(&cb->buffer);
+ }
+ switch_channel_set_private(channel, "snapshot", NULL);
+ }
+
+ 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);
+ }
+ switch_mutex_unlock(cb->mutex);
+ }
+
+ }
+ break;
+ case SWITCH_ABC_TYPE_WRITE:
+ default:
+ break;
+ }
+
+ return SWITCH_TRUE;
+}
+
+static switch_status_t start_capture(switch_core_session_t *session, unsigned int seconds, switch_media_bug_flag_t flags, const char *base)
+{
+ 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};
+ struct cap_cb *cb;
+ switch_size_t bytes;
+ switch_bind_flag_t bind_flags = 0;
+
+ if (switch_channel_get_private(channel, "snapshot")) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Already Running.\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (seconds < 5) {
+ 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);
+
+ 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);
+ switch_mutex_init(&cb->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+
+ if ((status = switch_core_media_bug_add(session, capture_callback, cb, 0, flags, &bug)) != SWITCH_STATUS_SUCCESS) {
+ return status;
+ }
+
+ bind_flags = SBF_DIAL_ALEG | SBF_EXEC_ALEG | SBF_EXEC_SAME;
+ switch_ivr_bind_dtmf_meta_session(session, 7, bind_flags, "snapshot::snap");
+
+ switch_channel_set_private(channel, "snapshot", bug);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t do_snap(switch_core_session_t *session)
+{
+ 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_size_t bytes_read;
+ int16_t pdata[4096] = {0};
+
+ if (bug) {
+ switch_time_exp_t tm;
+ switch_size_t retsize;
+ char date[80] = "";
+ struct cap_cb *cb = (struct cap_cb *) switch_core_media_bug_get_user_data(bug);
+
+ if (!cb) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ 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);
+
+ 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) {
+ 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);
+ return SWITCH_STATUS_FALSE;
+ }
+
+ 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;
+ }
+ }
+ switch_mutex_unlock(cb->mutex);
+ switch_core_file_close(&fh);
+ switch_core_set_variable("file", file);
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Wrote %s\n", file);
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+
+}
+
+#define SNAP_SYNTAX "start <sec> <read|write>"
+SWITCH_STANDARD_APP(snapshot_app_function)
+{
+ char *argv[4] = { 0 };
+ int argc = 0;
+ char *lbuf = NULL;
+ switch_media_bug_flag_t flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING;
+
+ 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;
+ }
+
+ if (!strcasecmp(argv[0], "start")) {
+ char *sec = argv[1];
+ char *fl = argv[2];
+ const char *base = argv[3];
+ int seconds = 5;
+
+ if (sec) {
+ int tmp = atoi(sec);
+ if (tmp > 5) {
+ seconds = tmp;
+ }
+ }
+
+ if (fl) {
+ flags = SMBF_READ_PING;
+ if (switch_stristr("read", fl)) {
+ flags |= SMBF_READ_STREAM;
+ }
+ if (switch_stristr("write", fl)) {
+ flags |= SMBF_WRITE_STREAM;
+ }
+ }
+
+ if (!base) {
+ base = "mod_snapshot";
+ }
+
+ start_capture(session, seconds, flags, base);
+
+ }
+
+ if (!strcasecmp(argv[0], "snap")) {
+ do_snap(session);
+ return;
+ }
+}
+
+
+#define SNAP_API_SYNTAX "<uuid> <warning>"
+SWITCH_STANDARD_API(snapshot_function)
+{
+ char *mycmd = NULL, *argv[5] = { 0 };
+ int argc = 0;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
+ argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ }
+
+ if (zstr(cmd) || argc < 1 || zstr(argv[0])) {
+ stream->write_function(stream, "-USAGE: %s\n", SNAP_API_SYNTAX);
+ goto done;
+ } else {
+ switch_core_session_t *lsession = NULL;
+
+ if ((lsession = switch_core_session_locate(argv[0]))) {
+ if (!strcasecmp(argv[1], "snap")) {
+ status = do_snap(lsession);
+ } else if (!strcasecmp(argv[1], "start")) {
+ char *sec = argv[1];
+ char *fl = argv[2];
+ 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) {
+ seconds = tmp;
+ }
+ }
+
+ if (fl) {
+ flags = SMBF_READ_PING;
+ if (switch_stristr("read", fl)) {
+ flags |= SMBF_READ_STREAM;
+ }
+ if (switch_stristr("write", fl)) {
+ flags |= SMBF_WRITE_STREAM;
+ }
+ }
+
+ if (!base) {
+ base = "mod_snapshot";
+ }
+
+ status = start_capture(lsession, seconds, flags, base);
+ }
+
+ switch_core_session_rwunlock(lsession);
+ }
+ }
+
+ if (status == SWITCH_STATUS_SUCCESS) {
+ stream->write_function(stream, "+OK Success\n");
+ } else {
+ stream->write_function(stream, "-ERR Operation Failed\n");
+ }
+
+ done:
+
+ switch_safe_free(mycmd);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/* Macro expands to: switch_status_t mod_snapshot_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
+SWITCH_MODULE_LOAD_FUNCTION(mod_snapshot_load)
+{
+ switch_api_interface_t *api_interface;
+ switch_application_interface_t *app_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, "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);
+
+ /* indicate that the module should continue to be loaded */
+ 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
+ */
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp 2009-11-02 10:10:22 UTC (rev 15314)
@@ -255,7 +255,7 @@
int x;
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
- if (!switch_strlen_zero(data) && !strcasecmp(data, "stop")) {
+ if (!zstr(data) && !strcasecmp(data, "stop")) {
switch_channel_set_private(channel, "_soundtouch_", NULL);
switch_core_media_bug_remove(session, &bug);
} else {
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_spy/mod_spy.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_spy/mod_spy.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_spy/mod_spy.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -188,7 +188,7 @@
char* argv[2] = {0};
char* params = NULL;
- if (!switch_strlen_zero(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);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_stress/mod_stress.cpp (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_stress/mod_stress.cpp 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_stress/mod_stress.cpp 2009-11-02 10:10:22 UTC (rev 15314)
@@ -206,7 +206,7 @@
int x = 0;
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_stress_"))) {
- if (!switch_strlen_zero(data) && !strcasecmp(data, "stop")) {
+ if (!zstr(data) && !strcasecmp(data, "stop")) {
switch_channel_set_private(channel, "_stress_", NULL);
switch_core_media_bug_remove(session, &bug);
} else {
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_valet_parking (from rev 15313, freeswitch/trunk/src/mod/applications/mod_valet_parking)
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_valet_parking/mod_valet_parking.2008.vcproj
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_valet_parking/mod_valet_parking.2008.vcproj (from rev 15313, freeswitch/trunk/src/mod/applications/mod_valet_parking/mod_valet_parking.2008.vcproj) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_valet_parking/mod_valet_parking.2008.vcproj (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_valet_parking/mod_valet_parking.2008.vcproj 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,287 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="mod_valet_parking"
+ ProjectGUID="{432DB165-1EB2-4781-A9C0-71E62610B20A}"
+ RootNamespace="mod_valet_parking"
+ 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"
+ 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="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"
+ 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"
+ 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"
+ 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"
+ 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_valet_parking.c"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_valet_parking/mod_valet_parking.c
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_valet_parking/mod_valet_parking.c (from rev 15313, freeswitch/trunk/src/mod/applications/mod_valet_parking/mod_valet_parking.c) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_valet_parking/mod_valet_parking.c (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_valet_parking/mod_valet_parking.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,368 @@
+/*
+ * 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):
+ *
+ * Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * mod_valet_parking.c -- Valet Parking Module
+ *
+ */
+#include <switch.h>
+#define VALET_EVENT "valet_parking::info"
+/* Prototypes */
+SWITCH_MODULE_LOAD_FUNCTION(mod_valet_parking_load);
+
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
+ * Defines a switch_loadable_module_function_table_t and a static const char[] modname
+ */
+SWITCH_MODULE_DEFINITION(mod_valet_parking, mod_valet_parking_load, NULL, NULL);
+
+typedef struct {
+ switch_hash_t *hash;
+ switch_mutex_t *mutex;
+ switch_memory_pool_t *pool;
+} valet_lot_t;
+
+static valet_lot_t globals = { 0 };
+
+
+static valet_lot_t *valet_find_lot(const char *name)
+{
+ valet_lot_t *lot;
+
+ switch_mutex_lock(globals.mutex);
+ if (!(lot = switch_core_hash_find(globals.hash, name))) {
+ switch_zmalloc(lot, sizeof(*lot));
+ switch_mutex_init(&lot->mutex, SWITCH_MUTEX_NESTED, globals.pool);
+ switch_core_hash_init(&lot->hash, NULL);
+ switch_core_hash_insert(globals.hash, name, lot);
+ }
+ switch_mutex_unlock(globals.mutex);
+ return lot;
+}
+
+static switch_status_t valet_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;
+
+ if (dtmf->digit == '#') {
+ return SWITCH_STATUS_BREAK;
+ }
+ }
+ default:
+ break;
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+
+static int next_id(valet_lot_t *lot, int min, int max, int in)
+{
+ int i, r = 0, m;
+ char buf[128] = "";
+
+ if (!min) min = 1;
+
+ switch_mutex_lock(globals.mutex);
+ for(i = min ; (i < max || max == 0) ; i++) {
+ switch_snprintf(buf, sizeof(buf), "%d", i);
+ m = !!switch_core_hash_find(lot->hash, buf);
+
+ if ((in && !m) || (!in && m)) {
+ r = i;
+ break;
+ }
+ }
+ switch_mutex_unlock(globals.mutex);
+
+ return r;
+}
+
+
+#define VALET_APP_SYNTAX "<lotname> <extension>|[ask [<min>] [<max>] [<to>] [<prompt>]]"
+SWITCH_STANDARD_APP(valet_parking_function)
+{
+ char *argv[6], *lbuf;
+ int argc;
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ switch_event_t *event;
+ char dtmf_buf[128] = "";
+ int is_auto = 0;
+
+ if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
+ && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) {
+ char *lot_name = argv[0];
+ char *ext = argv[1];
+ valet_lot_t *lot;
+ const char *uuid;
+ const char *music = "silence";
+ const char *tmp = NULL;
+ switch_status_t status;
+ switch_input_args_t args = { 0 };
+ char dbuf[10];
+ char *dest;
+
+ lot = valet_find_lot(lot_name);
+ switch_assert(lot);
+
+ if (!strcasecmp(ext, "auto")) {
+ const char *io = argv[2];
+ const char *min = argv[3];
+ const char *max = argv[4];
+ int min_i, max_i, id, in = -1;
+
+ if (argc < 5) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", VALET_APP_SYNTAX);
+ return;
+ }
+
+ if (io) {
+ if (!strcasecmp(io, "in")) {
+ in = 1;
+ is_auto = 1;
+ } else if (!strcasecmp(io, "out")) {
+ in = 0;
+ }
+ }
+
+ if (in < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", VALET_APP_SYNTAX);
+ switch_mutex_unlock(lot->mutex);
+ return;
+ }
+
+ min_i = atoi(min);
+ max_i = atoi(max);
+
+ if (!(id = next_id(lot, min_i, max_i, in))) {
+ switch_ivr_phrase_macro(session, in ? "valet_lot_full" : "valet_lot_empty", "", NULL, NULL);
+ switch_mutex_unlock(lot->mutex);
+ return;
+ }
+
+ switch_snprintf(dtmf_buf, sizeof(dtmf_buf), "%d", id);
+ ext = dtmf_buf;
+ } else if (!strcasecmp(ext, "ask")) {
+ const char *prompt = "ivr/ivr-enter_ext_pound.wav";
+ int min = 1;
+ 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;
+ }
+
+ do {
+ status = switch_ivr_read(session, min, max, prompt, NULL, dtmf_buf, sizeof(dtmf_buf), to, "#");
+ } while (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_FALSE);
+
+ if (status == SWITCH_STATUS_SUCCESS) {
+ ext = dtmf_buf;
+ } else {
+ 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;
+ if ((b_session = switch_core_session_locate(uuid))) {
+ 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);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "bridge");
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-To-UUID", switch_core_session_get_uuid(session));
+ 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;
+ }
+ }
+ }
+
+ dest = switch_core_session_sprintf(session, "sleep:1000,valet_park:%s %s", lot_name, ext);
+ switch_channel_set_variable(channel, "inline_destination", dest);
+
+ if (is_auto) {
+ char tmp[512] = "";
+ switch_snprintf(tmp, sizeof(tmp), "%s:%s", lot_name, ext);
+
+ 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);
+ switch_mutex_unlock(lot->mutex);
+ switch_core_session_rwunlock(b_session);
+ switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+ return;
+ }
+ }
+
+ 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);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "hold");
+ 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;
+
+ 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);
+
+ switch_mutex_unlock(lot->mutex);
+ if (!strcasecmp(music, "silence")) {
+ switch_ivr_collect_digits_callback(session, &args, 0, 0);
+ } else {
+ switch_ivr_play_file(session, NULL, music, &args);
+ }
+ switch_mutex_lock(lot->mutex);
+ switch_core_hash_delete(lot->hash, ext);
+ switch_mutex_unlock(lot->mutex);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", VALET_APP_SYNTAX);
+ }
+}
+
+SWITCH_STANDARD_API(valet_info_function)
+{
+ switch_hash_index_t *hi;
+ const void *var;
+ void *val;
+ char *name;
+ valet_lot_t *lot;
+
+ stream->write_function(stream, "<lots>\n");
+
+ switch_mutex_lock(globals.mutex);
+ for (hi = switch_hash_first(NULL, globals.hash); hi; hi = switch_hash_next(hi)) {
+ switch_hash_index_t *i_hi;
+ const void *i_var;
+ void *i_val;
+ char *i_ext;
+ char *i_uuid;
+
+ switch_hash_this(hi, &var, NULL, &val);
+ name = (char *) var;
+ lot = (valet_lot_t *) val;
+
+ 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)) {
+ switch_hash_this(i_hi, &i_var, NULL, &i_val);
+ i_ext = (char *) i_var;
+ i_uuid = (char *) i_val;
+ stream->write_function(stream, " <extension uuid=\"%s\">%s</extension>\n", i_uuid, i_ext);
+ }
+ stream->write_function(stream, " </lot>\n");
+ }
+
+ stream->write_function(stream, "</lots>\n");
+
+ switch_mutex_unlock(globals.mutex);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/* Macro expands to: switch_status_t mod_valet_parking_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
+SWITCH_MODULE_LOAD_FUNCTION(mod_valet_parking_load)
+{
+ switch_application_interface_t *app_interface;
+ switch_api_interface_t *api_interface;
+
+ /* create/register custom event message type */
+ if (switch_event_reserve_subclass(VALET_EVENT) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", VALET_EVENT);
+ return SWITCH_STATUS_TERM;
+ }
+
+ globals.pool = pool;
+ switch_core_hash_init(&globals.hash, NULL);
+ switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
+
+ /* 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, "valet_park", "valet_park", "valet_park", valet_parking_function, VALET_APP_SYNTAX, SAF_NONE);
+ SWITCH_ADD_API(api_interface, "valet_info", "Valet Parking Info", valet_info_function, "[<lot name>]");
+
+ return SWITCH_STATUS_NOUNLOAD;
+}
+
+/* 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
+ */
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_vmd/mod_vmd.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_vmd/mod_vmd.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_vmd/mod_vmd.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -611,20 +611,20 @@
*/
SWITCH_STANDARD_API(vmd_api_main)
{
- switch_core_session_t *vmd_session;
+ 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;
+ char *ccmd = NULL;
char *uuid;
char *command;
int i;
/* No command? Display usage */
- if (cmd == NULL) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -638,8 +638,7 @@
* display usage */
if (argc != VMD_PARAMS) {
stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
- switch_safe_free(ccmd);
- return SWITCH_STATUS_SUCCESS;
+ goto end;
}
uuid = argv[0];
@@ -650,9 +649,8 @@
/* If the session was not found exit */
if (vmd_session == NULL) {
- switch_safe_free(ccmd);
stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
- return SWITCH_STATUS_FALSE;
+ goto end;
}
/* Get current channel of the session to tag the session
@@ -669,21 +667,18 @@
switch_core_media_bug_remove(vmd_session, &bug);
switch_safe_free(ccmd);
stream->write_function(stream, "+OK\n");
- return SWITCH_STATUS_SUCCESS;
+ 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");
-
- switch_safe_free(ccmd);
- return SWITCH_STATUS_FALSE;
+ goto end;
}
/* 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", VMD_SYNTAX);
- return SWITCH_STATUS_FALSE;
+ goto end;
}
/* Allocate memory attached to this FreeSWITCH session for
@@ -712,9 +707,7 @@
/* 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");
-
- switch_safe_free(ccmd);
- return SWITCH_STATUS_FALSE;
+ goto end;
}
/* Set the vmd tag to detect an existing vmd media bug */
@@ -723,7 +716,15 @@
/* Everything went according to plan! Notify the user */
stream->write_function(stream, "+OK\n");
+
+ end:
+
+ if (vmd_session) {
+ switch_core_session_rwunlock(vmd_session);
+ }
+
switch_safe_free(ccmd);
+
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_voicemail/mod_voicemail.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_voicemail/mod_voicemail.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/applications/mod_voicemail/mod_voicemail.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -130,6 +130,8 @@
char *web_tail;
char *email_from;
char *date_fmt;
+ char *convert_cmd;
+ char *convert_ext;
date_location_t play_date_announcement;
uint32_t digit_timeout;
uint32_t max_login_attempts;
@@ -553,7 +555,13 @@
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,
+ &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,
@@ -661,7 +669,7 @@
switch_thread_rwlock_create(&profile->rwlock, pool);
profile->name = switch_core_strdup(pool, profile_name);
- if (!switch_strlen_zero(profile->odbc_dsn)) {
+ if (!zstr(profile->odbc_dsn)) {
if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
*(profile->odbc_user++) = '\0';
if ((profile->odbc_pass = strchr(profile->odbc_user, ':'))) {
@@ -771,6 +779,9 @@
if (xml) {
switch_xml_free(xml);
}
+ if (event) {
+ switch_event_destroy(&event);
+ }
return profile;
}
@@ -1232,6 +1243,8 @@
int want;
msg_type_t type;
msg_move_t move;
+ char *convert_cmd;
+ char *convert_ext;
};
typedef struct listen_callback listen_callback_t;
@@ -1561,7 +1574,7 @@
char *sql = switch_mprintf("update voicemail_msgs set flags='delete' where uuid='%s'", cbt->uuid);
vm_execute_sql(profile, sql, profile->mutex);
switch_safe_free(sql);
- if (!strcmp(input, profile->email_key) && !switch_strlen_zero(cbt->email)) {
+ if (!strcmp(input, profile->email_key) && !zstr(cbt->email)) {
switch_event_t *event;
char *from;
char *headers, *header_string;
@@ -1621,13 +1634,13 @@
switch_channel_set_variable(channel, "voicemail_message_len", duration_str);
switch_channel_set_variable(channel, "voicemail_email", cbt->email);
- if (switch_strlen_zero(profile->email_headers)) {
+ if (zstr(profile->email_headers)) {
from = switch_core_session_sprintf(session, "%s@%s", cbt->user, cbt->domain);
} else {
from = switch_channel_expand_variables(channel, profile->email_from);
}
- if (switch_strlen_zero(profile->email_headers)) {
+ if (zstr(profile->email_headers)) {
headers = switch_core_session_sprintf(session,
"From: FreeSWITCH mod_voicemail <%s@%s>\nSubject: Voicemail from %s %s\nX-Priority: %d",
cbt->user, cbt->domain, cbt->cid_name, cbt->cid_number, priority);
@@ -1659,7 +1672,7 @@
body = switch_mprintf("%u second Voicemail from %s %s", message_len, cbt->cid_name, cbt->cid_number);
}
- switch_simple_email(cbt->email, from, header_string, body, cbt->file_path);
+ switch_simple_email(cbt->email, from, header_string, body, cbt->file_path, cbt->convert_cmd, cbt->convert_ext);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending message to %s\n", cbt->email);
switch_safe_free(body);
TRY_CODE(switch_ivr_phrase_macro(session, VM_ACK_MACRO, "emailed", NULL, NULL));
@@ -1735,6 +1748,8 @@
int total_saved_urgent_messages = 0;
int heard_auto_saved = 0, heard_auto_new = 0;
char *vm_email = NULL;
+ char *convert_cmd = profile->convert_cmd;
+ char *convert_ext = profile->convert_ext;
char *vm_storage_dir = NULL;
char global_buf[2] = "";
switch_input_args_t args = { 0 };
@@ -1806,7 +1821,7 @@
switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-new", total_new_urgent_messages);
TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, &folder_args));
informed++;
- if (!switch_strlen_zero_buf(global_buf)) {
+ if (!zstr_buf(global_buf)) {
vm_check_state = VM_CHECK_MENU;
continue;
}
@@ -1815,7 +1830,7 @@
switch_snprintf(msg_count, sizeof(msg_count), "%d:new", total_new_messages);
TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, &folder_args));
informed++;
- if (!switch_strlen_zero_buf(global_buf)) {
+ if (!zstr_buf(global_buf)) {
vm_check_state = VM_CHECK_MENU;
continue;
}
@@ -1849,6 +1864,8 @@
&total_new_urgent_messages, &total_saved_urgent_messages);
memset(&cbt, 0, sizeof(cbt));
cbt.email = vm_email;
+ cbt.convert_cmd = convert_cmd;
+ cbt.convert_ext = convert_ext;
cbt.move = VM_MOVE_NEXT;
switch (play_msg_type) {
case MSG_NEW:
@@ -2033,7 +2050,7 @@
char input[10] = "";
char key_buf[80] = "";
play_msg_type = MSG_NONE;
- if (!switch_strlen_zero_buf(global_buf)) {
+ if (!zstr_buf(global_buf)) {
switch_set_string(input, global_buf);
*global_buf = '\0';
status = SWITCH_STATUS_SUCCESS;
@@ -2143,8 +2160,8 @@
} else if (!auth && !thepass && !strcasecmp(var, "password")) {
thepass = switch_core_session_strdup(session, val);
} else if (!auth && !strcasecmp(var, "vm-password")) {
- if (!switch_strlen_zero(val) && !strcasecmp(val, "user-choose")) {
- if (switch_strlen_zero(cbt.password)) {
+ if (!zstr(val) && !strcasecmp(val, "user-choose")) {
+ if (zstr(cbt.password)) {
auth = 1;
} else {
thepass = switch_core_session_strdup(session, val);
@@ -2154,9 +2171,13 @@
}
} else if (!strcasecmp(var, "vm-mailto")) {
vm_email = switch_core_session_strdup(session, val);
+ } else if (!strcasecmp(var, "vm-convert-cmd")) {
+ convert_cmd = switch_core_session_strdup(session, val);
+ } else if (!strcasecmp(var, "vm-convert-ext")) {
+ 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);
}
@@ -2184,12 +2205,12 @@
thehash = vmhash;
}
- if (!auth && !thepass && !switch_strlen_zero(cbt.password)) {
+ if (!auth && !thepass && !zstr(cbt.password)) {
thepass = cbt.password;
}
if (!auth) {
- if (!switch_strlen_zero(cbt.password) && !strcmp(cbt.password, mypass)) {
+ if (!zstr(cbt.password) && !strcmp(cbt.password, mypass)) {
auth++;
} else if (!thepass) {
auth++;
@@ -2216,9 +2237,9 @@
if (auth) {
if (!dir_path) {
- if (!switch_strlen_zero(vm_storage_dir)) {
+ if (!zstr(vm_storage_dir)) {
dir_path = switch_core_session_sprintf(session, "%s%s%s", vm_storage_dir, SWITCH_PATH_SEPARATOR, myid);
- } else if ( !switch_strlen_zero(profile->storage_dir) ) {
+ } 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,
@@ -2304,7 +2325,9 @@
const char *tmp;
switch_event_t *local_event = NULL;
switch_status_t ret = SWITCH_STATUS_SUCCESS;
-
+ char *convert_cmd = profile->convert_cmd;
+ char *convert_ext = profile->convert_ext;
+
if (!params) {
switch_event_create(&local_event, SWITCH_EVENT_REQUEST_PARAMS);
params = local_event;
@@ -2357,6 +2380,10 @@
insert_db = switch_true(val);
} else if (!strcasecmp(var, "vm-attach-file")) {
email_attach = switch_true(val);
+ } else if (!strcasecmp(var, "vm-convert-cmd")) {
+ convert_cmd = switch_core_strdup(pool, val);
+ } else if (!strcasecmp(var, "vm-convert-ext")) {
+ convert_ext = switch_core_strdup(pool, val);
} else if (!strcasecmp(var, "timezone")) {
vm_timezone = switch_core_strdup(pool, val);
}
@@ -2365,9 +2392,9 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deliver VM to %s@%s\n", myid, domain_name);
- if (!switch_strlen_zero(vm_storage_dir)) {
+ if (!zstr(vm_storage_dir)) {
dir_path = switch_mprintf("%s%s%s", vm_storage_dir, SWITCH_PATH_SEPARATOR, myid);
- } else if (!switch_strlen_zero(profile->storage_dir)) {
+ } else if (!zstr(profile->storage_dir)) {
dir_path = switch_mprintf("%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, myid);
} else {
dir_path = switch_mprintf("%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
@@ -2426,7 +2453,7 @@
update_mwi(profile, myid, domain_name, myfolder);
}
- if (send_mail && !switch_strlen_zero(vm_email) && switch_file_exists(file_path, pool) == SWITCH_STATUS_SUCCESS) {
+ if (send_mail && !zstr(vm_email) && switch_file_exists(file_path, pool) == SWITCH_STATUS_SUCCESS) {
switch_event_t *event;
char *from;
char *body;
@@ -2448,7 +2475,7 @@
message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
&total_new_urgent_messages, &total_saved_urgent_messages);
- if (switch_strlen_zero(vm_timezone) || (switch_strftime_tz(vm_timezone, profile->date_fmt, date, sizeof(date), 0) != SWITCH_STATUS_SUCCESS)) {
+ if (zstr(vm_timezone) || (switch_strftime_tz(vm_timezone, profile->date_fmt, date, sizeof(date), 0) != SWITCH_STATUS_SUCCESS)) {
switch_time_exp_lt(&tm, switch_micro_time_now());
switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
}
@@ -2486,7 +2513,7 @@
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_message_len", duration_str);
- if (switch_strlen_zero(profile->email_from)) {
+ if (zstr(profile->email_from)) {
from = switch_core_sprintf(pool, "%s@%s", myid, domain_name);
} else {
from = switch_event_expand_headers(params, profile->email_from);
@@ -2494,7 +2521,7 @@
if (send_main) {
- if (switch_strlen_zero(profile->email_headers)) {
+ if (zstr(profile->email_headers)) {
headers = switch_mprintf(
"From: FreeSWITCH mod_voicemail <%s@%s>\n"
"Subject: Voicemail from %s %s\nX-Priority: %d",
@@ -2528,9 +2555,9 @@
}
if (email_attach) {
- switch_simple_email(vm_email, from, header_string, body, file_path);
+ switch_simple_email(vm_email, from, header_string, body, file_path, convert_cmd, convert_ext);
} else {
- switch_simple_email(vm_email, from, header_string, body, NULL);
+ switch_simple_email(vm_email, from, header_string, body, NULL, NULL, NULL);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending message to %s\n", vm_email);
@@ -2546,7 +2573,7 @@
if (send_notify) {
- if (switch_strlen_zero(profile->notify_email_headers)) {
+ if (zstr(profile->notify_email_headers)) {
headers = switch_mprintf(
"From: FreeSWITCH mod_voicemail <%s@%s>\n"
"Subject: Voicemail from %s %s\nX-Priority: %d",
@@ -2579,7 +2606,7 @@
body = switch_mprintf("%u second Voicemail from %s %s", message_len, caller_id_name, caller_id_number);
}
- switch_simple_email(vm_notify_email, from, header_string, body, NULL);
+ 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);
@@ -2624,7 +2651,7 @@
char *box, *path, *cid_num, *cid_name;
switch_memory_pool_t *pool = NULL;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
status = SWITCH_STATUS_FALSE;
goto end;
}
@@ -2826,6 +2853,11 @@
switch_event_t *vars = NULL;
const char *vm_cc = NULL, *vtmp, *vm_ext = NULL;
int disk_quota = 0;
+ switch_bool_t skip_greeting = switch_true(switch_channel_get_variable(channel, "skip_greeting"));
+ switch_bool_t skip_instructions = switch_true(switch_channel_get_variable(channel, "skip_instructions"));
+
+ 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;
@@ -2877,17 +2909,17 @@
}
}
- if (send_main && switch_strlen_zero(vm_email) && !switch_strlen_zero(email_addr)) {
+ if (send_main && zstr(vm_email) && !zstr(email_addr)) {
vm_email = switch_core_session_strdup(session, email_addr);
- if (switch_strlen_zero(vm_email)) {
+ if (zstr(vm_email)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "No email address, not going to send email.\n");
send_main = 0;
}
}
- if (send_notify && switch_strlen_zero(vm_notify_email)) {
+ if (send_notify && zstr(vm_notify_email)) {
vm_notify_email = vm_email;
- if (switch_strlen_zero(vm_notify_email)) {
+ if (zstr(vm_notify_email)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "No notify email address, not going to notify.\n");
send_notify = 0;
}
@@ -2915,9 +2947,9 @@
}
}
- if (!switch_strlen_zero(vm_storage_dir)) {
+ if (!zstr(vm_storage_dir)) {
dir_path = switch_core_session_sprintf(session, "%s%s%s", vm_storage_dir, SWITCH_PATH_SEPARATOR, id);
- } else if (!switch_strlen_zero(profile->storage_dir)) {
+ } 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, id);
} else {
dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
@@ -2949,76 +2981,82 @@
greet_path = cbt.greeting_path;
}
- greet:
- memset(buf, 0, sizeof(buf));
- args.input_callback = cancel_on_dtmf;
- args.buf = buf;
- args.buflen = sizeof(buf);
+greet:
+ if (!skip_greeting) {
+ memset(buf, 0, sizeof(buf));
+ args.input_callback = cancel_on_dtmf;
+ args.buf = buf;
+ args.buflen = sizeof(buf);
- switch_ivr_sleep(session, 100, SWITCH_TRUE, NULL);
+ switch_ivr_sleep(session, 100, SWITCH_TRUE, NULL);
- if (!switch_strlen_zero(greet_path)) {
- memset(buf, 0, sizeof(buf));
- TRY_CODE(switch_ivr_play_file(session, NULL, greet_path, &args));
- } else {
- if (!switch_strlen_zero(cbt.name_path)) {
+ if (!zstr(greet_path)) {
memset(buf, 0, sizeof(buf));
- TRY_CODE(switch_ivr_play_file(session, NULL, cbt.name_path, &args));
- }
- if (*buf == '\0') {
- if (!read_id) {
- if (!(read_id = switch_channel_get_variable(channel, "voicemail_alternate_greet_id"))) {
- read_id = id;
+ TRY_CODE(switch_ivr_play_file(session, NULL, greet_path, &args));
+ } else {
+ if (!zstr(cbt.name_path)) {
+ memset(buf, 0, sizeof(buf));
+ TRY_CODE(switch_ivr_play_file(session, NULL, cbt.name_path, &args));
+ }
+ if (*buf == '\0') {
+ if (!read_id) {
+ if (!(read_id = switch_channel_get_variable(channel, "voicemail_alternate_greet_id"))) {
+ read_id = id;
+ }
}
+ memset(buf, 0, sizeof(buf));
+ TRY_CODE(switch_ivr_phrase_macro(session, VM_PLAY_GREETING_MACRO, read_id, NULL, &args));
}
- memset(buf, 0, sizeof(buf));
- TRY_CODE(switch_ivr_phrase_macro(session, VM_PLAY_GREETING_MACRO, read_id, NULL, &args));
}
- }
- 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) && !switch_strlen_zero(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 (!switch_strlen_zero(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) && !switch_strlen_zero(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 (!switch_strlen_zero(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 {
+ goto greet;
}
- } else if (*profile->skip_greet_key && !strcasecmp(buf, profile->skip_greet_key)) {
- record_macro = NULL;
- } else {
- goto greet;
}
}
+ if (skip_instructions) {
+ record_macro = NULL;
+ }
+
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);
@@ -3026,7 +3064,7 @@
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, sql, sql2str_callback, &callback);
+ vm_execute_sql_callback(profile, profile->mutex, sqlstmt, sql2str_callback, &callback);
if (atoi(disk_usage) >= disk_quota) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Voicemail disk quota is exceeded for %s\n", id);
@@ -3142,7 +3180,7 @@
int x = 0, check = 0, auth = 0;
switch_channel_t *channel = switch_core_session_get_channel(session);
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -3175,19 +3213,19 @@
auth = 1;
}
- if (switch_strlen_zero(profile_name)) {
+ if (zstr(profile_name)) {
profile_name = switch_channel_get_variable(channel, "voicemail_profile_name");
}
- if (switch_strlen_zero(domain_name)) {
+ if (zstr(domain_name)) {
domain_name = switch_channel_get_variable(channel, "voicemail_domain_name");
}
- if (switch_strlen_zero(id)) {
+ if (zstr(id)) {
id = switch_channel_get_variable(channel, "voicemail_id");
}
- if (switch_strlen_zero(profile_name) || switch_strlen_zero(domain_name)) {
+ if (zstr(profile_name) || zstr(domain_name)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error Usage: %s\n", VM_USAGE);
return;
}
@@ -3219,7 +3257,7 @@
vm_profile_t *profile;
char *id, *domain, *p, *profilename = NULL;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%d", 0);
return SWITCH_STATUS_SUCCESS;
}
@@ -3236,7 +3274,7 @@
id += 4;
}
- if (switch_strlen_zero(id)) {
+ if (zstr(id)) {
stream->write_function(stream, "%d", 0);
goto done;
}
@@ -3248,7 +3286,7 @@
how = p;
}
- if (!switch_strlen_zero(profilename)) {
+ if (!zstr(profilename)) {
if ((profile = get_profile(profilename))) {
message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,
&total_new_urgent_messages, &total_saved_urgent_messages);
@@ -3289,7 +3327,77 @@
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)
+{
+ char *dup = NULL;
+ const char *how = "greeting_path";
+ vm_profile_t *profile = NULL;
+ char *id, *domain, *p, *profilename = NULL;
+ char sql[256];
+ prefs_callback_t cbt = {{0}};
+ if (zstr(cmd)) {
+ stream->write_function(stream, "%d", 0);
+ goto done;
+ }
+
+ id = dup = strdup(cmd);
+
+ if ((p = strchr(dup, '/'))) {
+ *p++ = '\0';
+ id = p;
+ profilename = dup;
+ }
+
+ if (!strncasecmp(id, "sip:", 4)) {
+ id += 4;
+ }
+
+ if (zstr(id)) {
+ stream->write_function(stream, "%d", 0);
+ goto done;
+ }
+
+ if ((domain = strchr(id, '@'))) {
+ *domain++ = '\0';
+ if ((p = strchr(domain, '|'))) {
+ *p++ = '\0';
+ how = p;
+ }
+
+ if (!zstr(profilename) && !(profile = get_profile(profilename))) {
+ stream->write_function(stream, "-ERR No such profile\n");
+ goto done;
+ }
+ if (!(profile = get_profile("default"))) {
+ stream->write_function(stream, "-ERR profile 'default' doesn't exist\n");
+ goto done;
+ }
+ } else {
+ stream->write_function(stream, "-ERR No domain specified\n");
+ goto done;
+
+ }
+
+ switch_snprintf(sql, sizeof(sql), "select * from voicemail_prefs where username='%s' and domain='%s'", id, domain);
+ vm_execute_sql_callback(profile, profile->mutex, sql, prefs_callback, &cbt);
+
+ if (!strcasecmp(how, "greeting_path")) {
+ stream->write_function(stream, "%s", cbt.greeting_path);
+ } else if (!strcasecmp(how, "name_path")) {
+ stream->write_function(stream, "%s", cbt.name_path);
+ } else if (!strcasecmp(how, "password")) {
+ 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:
+ switch_safe_free(dup);
+ return SWITCH_STATUS_SUCCESS;
+}
+
#define parse_profile() {\
total_new_messages = total_saved_messages = 0; \
message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages, \
@@ -3853,7 +3961,7 @@
path_info = switch_event_get_header(stream->param_event, "http-path-info");
}
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -4012,8 +4120,8 @@
SWITCH_ADD_API(commands_api_interface, "voicemail", "voicemail", voicemail_api_function, VOICEMAIL_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "voicemail_inject", "voicemail_inject", voicemail_inject_api_function, VM_INJECT_USAGE);
SWITCH_ADD_API(commands_api_interface, "vm_boxcount", "vm_boxcount", boxcount_api_function, BOXCOUNT_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "vm_prefs", "vm_prefs", prefs_api_function, PREFS_SYNTAX);
-
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/asr_tts/mod_cepstral/mod_cepstral.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/asr_tts/mod_cepstral/mod_cepstral.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/asr_tts/mod_cepstral/mod_cepstral.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -146,7 +146,7 @@
voice_name = NULL;
}
- if (switch_strlen_zero(voice_name)) {
+ if (zstr(voice_name)) {
/* Find the first voice on the system */
if ((cepstral->voice = swift_port_find_first_voice(cepstral->port, NULL, NULL)) == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find any voices!\n");
@@ -215,18 +215,18 @@
cepstral->tts_stream = NULL;
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
return SWITCH_STATUS_FALSE;
}
if (!strncasecmp(text, fp, len)) {
text += len;
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
return SWITCH_STATUS_FALSE;
}
swift_port_speak_file(cepstral->port, text, NULL, &cepstral->tts_stream, NULL);
} else {
char *to_say;
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
return SWITCH_STATUS_FALSE;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -282,11 +282,11 @@
switch_mutex_lock(ps->flag_mutex);
if ((hyp = ps_get_hyp(ps->ps, &ps->score, &ps->uttid))) {
- if (!switch_strlen_zero(hyp)) {
+ 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 (switch_strlen_zero(hyp)) {
+ if (zstr(hyp)) {
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);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -75,7 +75,7 @@
switch_xml_free(xml);
}
- if (switch_strlen_zero(globals.command)) {
+ if (zstr(globals.command)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No command set, please edit %s\n", cf);
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -164,12 +164,15 @@
static int get_next_speech_channel_number(void);
#define XML_ID "<?xml"
+#define SRGS_ID "<grammar"
+#define SSML_ID "<speak"
#define GSL_ID ";GSL2.0"
#define ABNF_ID "#ABNF"
#define JSGF_ID "#JSGF"
#define BUILTIN_ID "builtin:"
#define SESSION_ID "session:"
#define HTTP_ID "http://"
+#define FILE_ID "file://"
#define INLINE_ID "inline:"
static int text_starts_with(const char *text, const char *match);
@@ -490,7 +493,7 @@
{
int result = 0;
- if (!switch_strlen_zero(text)) {
+ if (!zstr(text)) {
size_t textlen, matchlen;
/* find first non-space character */
@@ -524,7 +527,7 @@
char *lname = "";
*audio_queue = NULL;
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
lname = "";
} else {
lname = switch_core_strdup(pool, name);
@@ -704,7 +707,7 @@
{
if (queue) {
char *name = queue->name;
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
name = "";
}
if (queue->buffer) {
@@ -779,7 +782,7 @@
}
switch_core_hash_init(&schan->params, pool);
schan->data = NULL;
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
schan->name = "";
} else {
schan->name = switch_core_strdup(pool, name);
@@ -959,7 +962,7 @@
}
/* good enough way of determining SSML or plain text body */
- if (text_starts_with(text, XML_ID)) {
+ if (text_starts_with(text, XML_ID) || text_starts_with(text, SSML_ID)) {
apt_string_assign(&generic_header->content_type, MIME_TYPE_SSML_XML, mrcp_message->pool);
} else {
apt_string_assign(&generic_header->content_type, MIME_TYPE_PLAIN_TEXT, mrcp_message->pool);
@@ -1017,7 +1020,7 @@
switch_hash_this(hi, &key, NULL, &val);
param_name = (char *)key;
param_val = (char *)val;
- if (!switch_strlen_zero(param_name) && !switch_strlen_zero(param_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);
if (id) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s: %s\n", schannel->name, param_name, param_val);
@@ -1272,11 +1275,11 @@
static switch_status_t speech_channel_set_param(speech_channel_t *schannel, const char *param, const char *val)
{
switch_mutex_lock(schannel->mutex);
- if (!switch_strlen_zero(param) && val != NULL) {
+ if (!zstr(param) && val != NULL) {
/* check if this is a FreeSWITCH param that needs to be translated to an MRCP param: e.g. voice ==> voice-name */
char *mrcp_param = (char *)switch_core_hash_find(schannel->application->fs_param_map, param);
char *lcparam = NULL;
- if (switch_strlen_zero(mrcp_param)) {
+ if (zstr(mrcp_param)) {
lcparam = switch_lc_strdup(param);
mrcp_param = lcparam;
}
@@ -1422,7 +1425,7 @@
sh->private_info = schannel;
/* try to open an MRCP channel */
- if (switch_strlen_zero(profile_name)) {
+ if (zstr(profile_name)) {
profile_name = globals.unimrcp_default_synth_profile;
}
profile = (profile_t *)switch_core_hash_find(globals.profiles, profile_name);
@@ -1437,7 +1440,7 @@
}
/* Set session TTS params */
- if (!switch_strlen_zero(voice_name)) {
+ if (!zstr(voice_name)) {
speech_channel_set_param(schannel, "Voice-Name", voice_name);
}
@@ -1476,7 +1479,7 @@
switch_status_t status = SWITCH_STATUS_SUCCESS;
speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
status = SWITCH_STATUS_FALSE;
} else {
status = synth_channel_speak(schannel, text);
@@ -1900,10 +1903,10 @@
/* 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");
- r->timers_started = switch_strlen_zero(start_input_timers) || strcasecmp(start_input_timers, "false");
+ r->timers_started = zstr(start_input_timers) || strcasecmp(start_input_timers, "false");
/* get the cached grammar */
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
grammar = r->last_grammar;
} else {
grammar = (grammar_t *)switch_core_hash_find(r->grammars, name);
@@ -1935,7 +1938,7 @@
/* set Content-Type */
mime_type = grammar_type_to_mime(grammar->type, schannel->profile);
- if (switch_strlen_zero(mime_type)) {
+ if (zstr(mime_type)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
@@ -2029,7 +2032,7 @@
goto done;
}
mime_type = grammar_type_to_mime(type, schannel->profile);
- if (switch_strlen_zero(mime_type)) {
+ if (zstr(mime_type)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
@@ -2084,7 +2087,7 @@
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
- if (switch_strlen_zero(grammar_name)) {
+ if (zstr(grammar_name)) {
status = SWITCH_STATUS_FALSE;
} else {
recognizer_data_t *r = (recognizer_data_t *)schannel->data;
@@ -2106,7 +2109,7 @@
recognizer_data_t *r;
switch_mutex_lock(schannel->mutex);
r = (recognizer_data_t *)schannel->data;
- if (!switch_strlen_zero(r->result)) {
+ 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) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) SUCCESS, start of input\n", schannel->name);
@@ -2180,12 +2183,12 @@
recognizer_data_t *r;
switch_mutex_lock(schannel->mutex);
r = (recognizer_data_t *)schannel->data;
- if (!switch_strlen_zero(r->result)) {
+ 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;
goto done;
}
- if (switch_strlen_zero(result)) {
+ if (zstr(result)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result is NULL\n", schannel->name);
status = SWITCH_STATUS_FALSE;
goto done;
@@ -2211,7 +2214,7 @@
switch_status_t status = SWITCH_STATUS_SUCCESS;
recognizer_data_t *r = (recognizer_data_t *)schannel->data;
switch_mutex_lock(schannel->mutex);
- if (!switch_strlen_zero(r->result)) {
+ if (!zstr(r->result)) {
*result = strdup(r->result);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result:\n\n%s\n", schannel->name, *result);
r->result = NULL;
@@ -2248,7 +2251,7 @@
switch_hash_this(hi, &key, NULL, &val);
param_name = (char *)key;
param_val = (char *)val;
- if (!switch_strlen_zero(param_name) && !switch_strlen_zero(param_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);
if (id) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) \"%s\": \"%s\"\n", schannel->name, param_name, param_val);
@@ -2572,7 +2575,7 @@
char *filename = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) grammar = %s, name = %s\n", schannel->name, grammar, name);
- if (switch_strlen_zero(grammar) || switch_strlen_zero(name)) {
+ if (zstr(grammar) || zstr(name)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
@@ -2584,7 +2587,7 @@
}
/* figure out what type of grammar this is */
- if (text_starts_with(grammar, HTTP_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;
@@ -2629,7 +2632,7 @@
/* determine content type of file grammar or inline grammar */
if (type == GRAMMAR_TYPE_UNKNOWN) {
- if (text_starts_with(grammar_data, XML_ID)) {
+ if (text_starts_with(grammar_data, XML_ID) || text_starts_with(grammar_data, SRGS_ID)) {
type = GRAMMAR_TYPE_SRGS_XML;
} else if (text_starts_with(grammar_data, GSL_ID)) {
type = GRAMMAR_TYPE_NUANCE_GSL;
@@ -2673,7 +2676,7 @@
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
- if (switch_strlen_zero(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS ||
+ if (zstr(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS ||
recog_channel_unload_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_FALSE;
}
@@ -3316,13 +3319,13 @@
}
/* set up MRCPv2 connection agent that will be shared with all profiles */
- if (!switch_strlen_zero(globals.unimrcp_max_connection_count)) {
+ if (!zstr(globals.unimrcp_max_connection_count)) {
max_connection_count = atoi(globals.unimrcp_max_connection_count);
}
if (max_connection_count <= 0) {
max_connection_count = 100;
}
- if (!switch_strlen_zero(globals.unimrcp_offer_new_connection)) {
+ if (!zstr(globals.unimrcp_offer_new_connection)) {
offer_new_connection = strcasecmp("true", globals.unimrcp_offer_new_connection);
}
connection_agent = mrcp_client_connection_agent_create(max_connection_count, offer_new_connection, pool);
@@ -3354,7 +3357,7 @@
/* get profile attributes */
const char *name = apr_pstrdup(pool, switch_xml_attr(profile, "name"));
const char *version = switch_xml_attr(profile, "version");
- if (switch_strlen_zero(name) || switch_strlen_zero(version)) {
+ if (zstr(name) || zstr(version)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "<profile> missing name or version attribute\n");
client = NULL;
goto done;
@@ -3381,7 +3384,7 @@
for (param = switch_xml_child(profile, "param"); param; param = switch_xml_next(param)) {
const char *param_name = switch_xml_attr(param, "name");
const char *param_value = switch_xml_attr(param, "value");
- if (switch_strlen_zero(param_name)) {
+ if (zstr(param_name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing param name\n");
client = NULL;
goto done;
@@ -3409,7 +3412,7 @@
for (param = switch_xml_child(profile, "param"); param; param = switch_xml_next(param)) {
const char *param_name = switch_xml_attr(param, "name");
const char *param_value = switch_xml_attr(param, "value");
- if (switch_strlen_zero(param_name)) {
+ if (zstr(param_name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing param name\n");
client = NULL;
goto done;
@@ -3468,11 +3471,11 @@
/* get MRCP module configuration */
mod_unimrcp_do_config();
- if (switch_strlen_zero(globals.unimrcp_default_synth_profile)) {
+ if (zstr(globals.unimrcp_default_synth_profile)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing default-tts-profile\n");
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(globals.unimrcp_default_recog_profile)) {
+ if (zstr(globals.unimrcp_default_recog_profile)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing default-asr-profile\n");
return SWITCH_STATUS_FALSE;
}
@@ -3575,7 +3578,7 @@
char log_message[4096] = { 0 }; /* same size as MAX_LOG_ENTRY_SIZE in UniMRCP apt_log.c */
size_t msglen;
- if (switch_strlen_zero(format)) {
+ if (zstr(format)) {
return TRUE;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_celt/Makefile (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_celt/Makefile 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_celt/Makefile 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1,6 +1,6 @@
BASE=../../../..
-CELT=celt-0.6.1
+CELT=celt-0.7.0
CELT_DIR=$(BASE)/libs/$(CELT)
LOCAL_CFLAGS=-I$(CELT_DIR)/libcelt
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_celt/mod_celt.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_celt/mod_celt.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_celt/mod_celt.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -53,7 +53,7 @@
return SWITCH_STATUS_FALSE;
}
- context->mode_object = celt_mode_create(codec->implementation->actual_samples_per_second, 1, 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;
@@ -81,11 +81,11 @@
codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "bitrate=%d", bit_rate);
*/
if (encoding) {
- context->encoder_object = celt_encoder_create(context->mode_object);
+ context->encoder_object = celt_encoder_create(context->mode_object, 1, NULL);
}
if (decoding) {
- context->decoder_object = celt_decoder_create(context->mode_object);
+ context->decoder_object = celt_decoder_create(context->mode_object, 1, NULL);
}
codec->private_info = context;
@@ -111,7 +111,7 @@
return SWITCH_STATUS_FALSE;
}
- *encoded_data_len = (uint32_t) celt_encode(context->encoder_object, (celt_int16_t *)decoded_data, NULL,
+ *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;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_voipcodecs/Makefile (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_voipcodecs/Makefile 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_voipcodecs/Makefile 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1,13 +1,28 @@
BASE=../../../..
-VOIPCODECS_DIR=$(BASE)/libs/voipcodecs
-VOIPCODECS_LA=$(VOIPCODECS_DIR)/src/libvoipcodecs.la
+TIFF_DIR=$(BASE)/libs/tiff-3.8.2
+TIFF_LA=$(TIFF_DIR)/libtiff/libtiff.la
-LOCAL_CFLAGS=-I$(VOIPCODECS_DIR)/src
-LOCAL_LIBADD=$(VOIPCODECS_LA)
+SPANDSP_DIR=$(BASE)/libs/spandsp
+SPANDSP_LA=$(SPANDSP_DIR)/src/libspandsp.la
+LOCAL_CFLAGS=-I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff
+LOCAL_LIBADD=$(SPANDSP_LA)
+
include $(BASE)/build/modmake.rules
-$(VOIPCODECS_LA): $(VOIPCODECS_DIR) $(VOIPCODECS_DIR)/.update
- cd $(VOIPCODECS_DIR) && $(MAKE)
+$(SPANDSP_LA): $(TIFF_LA) $(SPANDSP_DIR) $(SPANDSP_DIR)/.update
+ cd $(SPANDSP_DIR) && $(MAKE)
$(TOUCH_TARGET)
+
+$(TIFF_LA): $(TIFF_DIR) $(TIFF_DIR)/.update
+ cd $(TIFF_DIR) && $(MAKE)
+ $(TOUCH_TARGET)
+
+
+depend_install: $(DESTDIR)$(libdir)/libspandsp.la
+
+$(DESTDIR)$(libdir)/libspandsp.la: $(SPANDSP_LA)
+ cd $(SPANDSP_DIR) && $(MAKE) install
+
+
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.2008.vcproj (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.2008.vcproj 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.2008.vcproj 2009-11-02 10:10:22 UTC (rev 15314)
@@ -42,7 +42,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\voipcodecs\src";"$(InputDir)..\..\..\..\libs\voipcodecs\src\msvc""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\spandsp\src\msvc";"$(InputDir)..\..\..\..\libs\spandsp\src";"$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff""
UsePrecompiledHeader="0"
/>
<Tool
@@ -105,7 +105,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\voipcodecs\src";"$(InputDir)..\..\..\..\libs\voipcodecs\src\msvc""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\spandsp\src\msvc";"$(InputDir)..\..\..\..\libs\spandsp\src";"$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff""
UsePrecompiledHeader="0"
/>
<Tool
@@ -169,7 +169,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\voipcodecs\src";"$(InputDir)..\..\..\..\libs\voipcodecs\src\msvc""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\spandsp\src\msvc";"$(InputDir)..\..\..\..\libs\spandsp\src";"$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff""
UsePrecompiledHeader="0"
/>
<Tool
@@ -232,7 +232,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\voipcodecs\src";"$(InputDir)..\..\..\..\libs\voipcodecs\src\msvc""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\spandsp\src\msvc";"$(InputDir)..\..\..\..\libs\spandsp\src";"$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff""
UsePrecompiledHeader="0"
/>
<Tool
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -33,7 +33,7 @@
*/
#include <switch.h>
-#include "voipcodecs.h"
+#include "spandsp.h"
SWITCH_MODULE_LOAD_FUNCTION(mod_voipcodecs_load);
SWITCH_MODULE_DEFINITION(mod_voipcodecs, mod_voipcodecs_load, NULL, NULL);
@@ -41,8 +41,8 @@
/* LPC10 - START */
struct lpc10_context {
- lpc10_encode_state_t encoder_object;
- lpc10_decode_state_t decoder_object;
+ lpc10_encode_state_t *encoder_object;
+ lpc10_decode_state_t *decoder_object;
};
static switch_status_t switch_lpc10_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
@@ -58,11 +58,11 @@
} else {
if (encoding) {
- lpc10_encode_init(&context->encoder_object, TRUE);
+ context->encoder_object = lpc10_encode_init(context->encoder_object, TRUE);
}
if (decoding) {
- lpc10_decode_init(&context->decoder_object, TRUE);
+ context->decoder_object = lpc10_decode_init(context->decoder_object, TRUE);
}
codec->private_info = context;
@@ -73,7 +73,18 @@
static switch_status_t switch_lpc10_destroy(switch_codec_t *codec)
{
+ struct lpc10_context *context = codec->private_info;
codec->private_info = NULL;
+
+ if (!context) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (context->encoder_object) lpc10_encode_free(context->encoder_object);
+ context->encoder_object = NULL;
+ if (context->decoder_object) lpc10_decode_free(context->decoder_object);
+ context->decoder_object = NULL;
+
return SWITCH_STATUS_SUCCESS;
}
@@ -90,7 +101,7 @@
return SWITCH_STATUS_FALSE;
}
- *encoded_data_len = lpc10_encode(&context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
+ *encoded_data_len = lpc10_encode(context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
return SWITCH_STATUS_SUCCESS;
}
@@ -108,7 +119,7 @@
return SWITCH_STATUS_FALSE;
}
- *decoded_data_len = (2 * lpc10_decode(&context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
+ *decoded_data_len = (2 * lpc10_decode(context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
return SWITCH_STATUS_SUCCESS;
}
@@ -118,8 +129,8 @@
/* GSM - START */
struct gsm_context {
- gsm0610_state_t decoder_object;
- gsm0610_state_t encoder_object;
+ gsm0610_state_t *decoder_object;
+ gsm0610_state_t *encoder_object;
};
static switch_status_t switch_gsm_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
@@ -134,10 +145,10 @@
return SWITCH_STATUS_FALSE;
} else {
if (encoding) {
- gsm0610_init(&context->encoder_object, GSM0610_PACKING_VOIP);
+ context->encoder_object = gsm0610_init(context->encoder_object, GSM0610_PACKING_VOIP);
}
if (decoding) {
- gsm0610_init(&context->decoder_object, GSM0610_PACKING_VOIP);
+ context->decoder_object = gsm0610_init(context->decoder_object, GSM0610_PACKING_VOIP);
}
codec->private_info = context;
@@ -157,7 +168,7 @@
return SWITCH_STATUS_FALSE;
}
- *encoded_data_len = gsm0610_encode(&context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
+ *encoded_data_len = gsm0610_encode(context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
return SWITCH_STATUS_SUCCESS;
}
@@ -174,15 +185,26 @@
return SWITCH_STATUS_FALSE;
}
- *decoded_data_len = (2 * gsm0610_decode(&context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
+ *decoded_data_len = (2 * gsm0610_decode(context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t switch_gsm_destroy(switch_codec_t *codec)
{
- /* We do not need to use release here as the pool memory is taken care of for us */
+ struct gsm_context *context = codec->private_info;
+
codec->private_info = NULL;
+
+ if (!context) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (context->decoder_object) gsm0610_free(context->decoder_object);
+ context->decoder_object = NULL;
+ if (context->encoder_object) gsm0610_free(context->encoder_object);
+ context->encoder_object = NULL;
+
return SWITCH_STATUS_SUCCESS;
}
@@ -338,8 +360,8 @@
/* G722 - START */
struct g722_context {
- g722_decode_state_t decoder_object;
- g722_encode_state_t encoder_object;
+ g722_decode_state_t *decoder_object;
+ g722_encode_state_t *encoder_object;
};
static switch_status_t switch_g722_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
@@ -354,10 +376,10 @@
return SWITCH_STATUS_FALSE;
} else {
if (encoding) {
- g722_encode_init(&context->encoder_object, 64000, G722_PACKED);
+ context->encoder_object = g722_encode_init(context->encoder_object, 64000, G722_PACKED);
}
if (decoding) {
- g722_decode_init(&context->decoder_object, 64000, G722_PACKED);
+ context->decoder_object = g722_decode_init(context->decoder_object, 64000, G722_PACKED);
}
}
@@ -378,7 +400,7 @@
return SWITCH_STATUS_FALSE;
}
- *encoded_data_len = g722_encode(&context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
+ *encoded_data_len = g722_encode(context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
return SWITCH_STATUS_SUCCESS;
}
@@ -396,15 +418,26 @@
return SWITCH_STATUS_FALSE;
}
- *decoded_data_len = (2 * g722_decode(&context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
+ *decoded_data_len = (2 * g722_decode(context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t switch_g722_destroy(switch_codec_t *codec)
{
- /* We do not need to use release here as the pool memory is taken care of for us */
+ struct g722_context *context = codec->private_info;
+
codec->private_info = NULL;
+
+ if (!context) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (context->decoder_object) g722_decode_free(context->decoder_object);
+ context->decoder_object = NULL;
+ if (context->encoder_object) g722_encode_free(context->encoder_object);
+ context->encoder_object = NULL;
+
return SWITCH_STATUS_SUCCESS;
}
@@ -416,27 +449,36 @@
{
uint32_t encoding, decoding;
int packing = G726_PACKING_RIGHT;
- g726_state_t *context;
+ g726_state_t *context = NULL;
encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
- if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context))))) {
+ if (!(encoding || decoding)) {
return SWITCH_STATUS_FALSE;
- } else {
- if ((flags & SWITCH_CODEC_FLAG_AAL2 || strstr(codec->implementation->iananame, "AAL2"))) {
- packing = G726_PACKING_LEFT;
- }
+ }
- g726_init(context, codec->implementation->bits_per_second, G726_ENCODING_LINEAR, packing);
+ 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;
- codec->private_info = context;
- return SWITCH_STATUS_SUCCESS;
- }
}
static switch_status_t switch_g726_destroy(switch_codec_t *codec)
{
+ g726_state_t *context = codec->private_info;
+
+ if (!context) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ g726_free(context);
+
codec->private_info = NULL;
return SWITCH_STATUS_SUCCESS;
}
@@ -482,8 +524,8 @@
/* IMA_ADPCM - START */
struct ima_adpcm_context {
- ima_adpcm_state_t decoder_object;
- ima_adpcm_state_t encoder_object;
+ ima_adpcm_state_t *decoder_object;
+ ima_adpcm_state_t *encoder_object;
};
static switch_status_t switch_adpcm_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
@@ -498,10 +540,10 @@
return SWITCH_STATUS_FALSE;
} else {
if (encoding) {
- ima_adpcm_init(&context->encoder_object, IMA_ADPCM_DVI4, 0);
+ context->encoder_object = ima_adpcm_init(context->encoder_object, IMA_ADPCM_DVI4, 0);
}
if (decoding) {
- ima_adpcm_init(&context->decoder_object, IMA_ADPCM_DVI4, 0);
+ context->decoder_object = ima_adpcm_init(context->decoder_object, IMA_ADPCM_DVI4, 0);
}
codec->private_info = context;
@@ -522,7 +564,7 @@
return SWITCH_STATUS_FALSE;
}
- *encoded_data_len = ima_adpcm_encode(&context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
+ *encoded_data_len = ima_adpcm_encode(context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
return SWITCH_STATUS_SUCCESS;
}
@@ -540,15 +582,26 @@
return SWITCH_STATUS_FALSE;
}
- *decoded_data_len = (2 * ima_adpcm_decode(&context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
+ *decoded_data_len = (2 * ima_adpcm_decode(context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t switch_adpcm_destroy(switch_codec_t *codec)
{
- /* We do not need to use release here as the pool memory is taken care of for us */
+ struct ima_adpcm_context *context = codec->private_info;
+
codec->private_info = NULL;
+
+ if (!context) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (context->decoder_object) ima_adpcm_free(context->decoder_object);
+ context->decoder_object = NULL;
+ if (context->encoder_object) ima_adpcm_free(context->encoder_object);
+ context->encoder_object = NULL;
+
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.vcproj (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.vcproj 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.vcproj 2009-11-02 10:10:22 UTC (rev 15314)
@@ -38,7 +38,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\voipcodecs\src";"$(InputDir)..\..\..\..\libs\voipcodecs\src\msvc""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\spandsp\src\msvc";"$(InputDir)..\..\..\..\libs\spandsp\src";"$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff""
UsePrecompiledHeader="0"
/>
<Tool
@@ -101,7 +101,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\voipcodecs\src";"$(InputDir)..\..\..\..\libs\voipcodecs\src\msvc""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\spandsp\src\msvc";"$(InputDir)..\..\..\..\libs\spandsp\src";"$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff""
UsePrecompiledHeader="0"
/>
<Tool
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -141,7 +141,7 @@
caller_profile = switch_channel_get_caller_profile(channel);
}
- if (!caller_profile || switch_strlen_zero(caller_profile->destination_number)) {
+ if (!caller_profile || zstr(caller_profile->destination_number)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Obtaining Profile!\n");
return NULL;
}
@@ -271,7 +271,7 @@
switch_regex_safe_free(re);
if (!extension) {
- if (switch_strlen_zero(field_data)) {
+ if (zstr(field_data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No extension!\n");
break;
}
@@ -313,7 +313,7 @@
} else {
profile = switch_core_get_variable("sip_profile");
}
- if (switch_strlen_zero(profile)) {
+ if (zstr(profile)) {
profile = "default";
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -262,10 +262,16 @@
if (anti_action) {
for (xaction = switch_xml_child(xcond, "anti-action"); xaction; xaction = xaction->next) {
const char *application = switch_xml_attr_soft(xaction, "application");
- const char *data = switch_xml_attr_soft(xaction, "data");
+ const char *data;
const char *inline_ = switch_xml_attr_soft(xaction, "inline");
int xinline = switch_true(inline_);
+ if (!zstr(xaction->txt)) {
+ data = xaction->txt;
+ } else {
+ data = (char *) switch_xml_attr_soft(xaction, "data");
+ }
+
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" : "");
@@ -295,7 +301,7 @@
const char *inline_ = switch_xml_attr_soft(xaction, "inline");
int xinline = switch_true(inline_);
- if (!switch_strlen_zero(xaction->txt)) {
+ if (!zstr(xaction->txt)) {
data = xaction->txt;
} else {
data = (char *) switch_xml_attr_soft(xaction, "data");
@@ -393,7 +399,7 @@
/* get our handle to the "dialplan" section of the config */
- if (!switch_strlen_zero(alt_path)) {
+ if (!zstr(alt_path)) {
switch_xml_t conf = NULL, tag = NULL;
if (!(alt_root = switch_xml_parse_file_simple(alt_path))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Open of [%s] failed\n", alt_path);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_alsa/mod_alsa.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_alsa/mod_alsa.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_alsa/mod_alsa.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -243,7 +243,6 @@
}
}
- switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
switch_channel_mark_ring_ready(channel);
while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
@@ -367,7 +366,7 @@
switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(tech_pvt->call_id)) {
+ if (zstr(tech_pvt->call_id)) {
snprintf(tech_pvt->call_id, sizeof(tech_pvt->call_id), "%d", ++globals.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);
@@ -786,7 +785,7 @@
if (outbound_profile) {
char name[128];
- const char *id = !switch_strlen_zero(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
+ const char *id = !zstr(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
snprintf(name, sizeof(name), "alsa/%s", id);
switch_channel_set_name(channel, name);
@@ -1187,7 +1186,7 @@
char *dtmf_str = argv[0];
switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
- if (switch_strlen_zero(dtmf_str)) {
+ if (zstr(dtmf_str)) {
stream->write_function(stream, "No DTMF Supplied!\n");
} else {
switch_mutex_lock(globals.pvt_lock);
@@ -1213,7 +1212,7 @@
uint8_t one_call = 0;
switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(callid)) {
+ if (zstr(callid)) {
if (globals.call_list) {
if (globals.call_list->next) {
tech_pvt = globals.call_list->next;
@@ -1259,7 +1258,7 @@
char *callid = argv[0];
switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(callid)) {
+ if (zstr(callid)) {
tech_pvt = globals.call_list;
} else {
tech_pvt = switch_core_hash_find(globals.call_hash, callid);
@@ -1286,7 +1285,7 @@
switch_mutex_lock(globals.pvt_lock);
- if (!switch_strlen_zero(callid)) {
+ if (!zstr(callid)) {
if ((tp = switch_core_hash_find(globals.call_hash, callid))) {
if (switch_test_flag(tp, TFLAG_ANSWER)) {
stream->write_function(stream, "CALL ALREADY ANSWERED\n");
@@ -1459,23 +1458,23 @@
return SWITCH_STATUS_MEMERR;
}
- if (!switch_strlen_zero(argv[1])) {
+ if (!zstr(argv[1])) {
dialplan = argv[1];
}
- if (!switch_strlen_zero(argv[2])) {
+ if (!zstr(argv[2])) {
cid_num = argv[2];
}
- if (!switch_strlen_zero(argv[3])) {
+ if (!zstr(argv[3])) {
cid_name = argv[3];
}
- if (!switch_strlen_zero(argv[4])) {
+ if (!zstr(argv[4])) {
tech_pvt->sample_rate = atoi(argv[4]);
}
- if (!switch_strlen_zero(argv[5])) {
+ if (!zstr(argv[5])) {
tech_pvt->codec_ms = atoi(argv[5]);
}
@@ -1577,13 +1576,13 @@
}
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto done;
}
} else {
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_dingaling/mod_dingaling.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_dingaling/mod_dingaling.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_dingaling/mod_dingaling.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -344,7 +344,7 @@
char *status = argv[4];
//char *proto = argv[5];
- if (switch_strlen_zero(type)) {
+ if (zstr(type)) {
type = NULL;
} else if (!strcasecmp(type, "unavailable")) {
status = NULL;
@@ -550,7 +550,7 @@
status = NULL;
}
- if (switch_strlen_zero(event_type)) {
+ if (zstr(event_type)) {
event_type = "presence";
}
@@ -1090,7 +1090,6 @@
started = switch_micro_time_now();
/* jingle has no ringing indication so we will just pretend that we got one */
- switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
switch_channel_mark_ring_ready(channel);
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
@@ -1994,7 +1993,7 @@
profile->password = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "avatar")) {
profile->avatar = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
if (switch_odbc_available()) {
profile->odbc_dsn = switch_core_strdup(module_pool, val);
if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
@@ -2008,17 +2007,17 @@
}
} else if (!strcasecmp(var, "use-rtp-timer") && switch_true(val)) {
switch_set_flag(profile, TFLAG_TIMER);
- } else if (!strcasecmp(var, "dialplan") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "dialplan") && !zstr(val)) {
profile->dialplan = switch_core_strdup(module_pool, val);
#ifdef AUTO_REPLY // gotta fix looping on this
} else if (!strcasecmp(var, "auto-reply")) {
profile->auto_reply = switch_core_strdup(module_pool, val);
#endif
- } else if (!strcasecmp(var, "name") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "name") && !zstr(val)) {
profile->name = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "message") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "message") && !zstr(val)) {
profile->message = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "local-network-acl") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "local-network-acl") && !zstr(val)) {
profile->local_network = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "rtp-ip")) {
profile->ip = switch_core_strdup(module_pool, strcasecmp(switch_str_nil(val), "auto") ? switch_str_nil(val) : globals.guess_ip);
@@ -2031,14 +2030,14 @@
ip = globals.guess_ip;
} else {
globals.auto_nat = 0;
- ip = switch_strlen_zero(val) ? globals.guess_ip : val;
+ ip = zstr(val) ? globals.guess_ip : val;
}
profile->extip = switch_core_strdup(module_pool, ip);
- } else if (!strcasecmp(var, "server") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "server") && !zstr(val)) {
profile->server = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "rtp-timer-name") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "rtp-timer-name") && !zstr(val)) {
profile->timer_name = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "lanaddr") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "lanaddr") && !zstr(val)) {
profile->lanaddr = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "candidate-acl")) {
if (profile->acl_count < MAX_ACL) {
@@ -2056,11 +2055,11 @@
} else if (val && !strcasecmp(val, "md5")) {
profile->user_flags |= LDL_FLAG_SASL_MD5;
}
- } else if (!strcasecmp(var, "exten") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "exten") && !zstr(val)) {
profile->exten = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "context") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "context") && !zstr(val)) {
profile->context = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "auto-login") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "auto-login") && !zstr(val)) {
if (switch_true(val)) {
switch_set_flag(profile, TFLAG_AUTO);
}
@@ -2163,7 +2162,7 @@
if (session) return status;
- if (switch_strlen_zero(cmd) || !(myarg = strdup(cmd))) {
+ if (zstr(cmd) || !(myarg = strdup(cmd))) {
stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX);
return SWITCH_STATUS_FALSE;
}
@@ -2215,7 +2214,7 @@
goto done;
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "USAGE: %s\n", LOGIN_SYNTAX);
status = SWITCH_STATUS_SUCCESS;
goto done;
@@ -2225,7 +2224,7 @@
argc = switch_separate_string(myarg, ';', argv, (sizeof(argv) / sizeof(argv[0])));
- if (switch_strlen_zero(cmd) || argc != 1) {
+ if (zstr(cmd) || argc != 1) {
stream->write_function(stream, "USAGE: %s\n", LOGIN_SYNTAX);
status = SWITCH_STATUS_SUCCESS;
goto done;
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323 (from rev 15313, freeswitch/trunk/src/mod/endpoints/mod_h323)
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/Makefile
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/Makefile (from rev 15313, freeswitch/trunk/src/mod/endpoints/mod_h323/Makefile) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/Makefile (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/Makefile 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,7 @@
+BASE=../../../..
+LOCAL_CFLAGS+=-g -ggdb -I/usr/include/ptlib -I/usr/include/openh323 -I. -DPTRACING=1 -D_REENTRANT -fno-exceptions
+LOCAL_LDFLAGS= -lopenh323 -lpt -lrt
+
+include $(BASE)/build/modmake.rules
+
+
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/bugs
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/bugs (from rev 15313, freeswitch/trunk/src/mod/endpoints/mod_h323/bugs) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/bugs (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/bugs 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,13 @@
+faststart and codecs v CallProceeding due to h323plus, grep "Very Frustrating - S.H." in h323plus
+source and uncomment commented lines.
+
+
+exploration form developer of h323plus:
+
+Yes that should be mera.
+
+The problem is that Callproceeding does not always come from the remote it
+may be generated by the gatekeeper. MERA where sending fast start elements
+in the Call proceeding and connect. The call proceeding where not valid and
+causing the media to fail. Normally (although valid) EP's do not set Fast
+Start in Call proceeding so the code was disabled to resolve the MERA issue.
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/changes.txt
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/changes.txt (from rev 15313, freeswitch/trunk/src/mod/endpoints/mod_h323/changes.txt) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/changes.txt (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/changes.txt 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,18 @@
+
+fixxxxes
+remove trys to implement non standard codecs.
+implement jitter-size value option.
+implement gk register retry timer.
+implement h245insetup enable/disable option.
+implement h245tunneling enable/disable option.
+implement faststart enable/disable option.
+fix release handling from h323 leg.
+fix misstype in codec conversion.
+fix rtp issue causes choppy sound.
+fix progress ind handling on outbound calls.
+fix crash on log line, btw not understand why.
+implement dtmf transfer.
+fix codec name conversion a bit.
+fix crash on inbound fast start connection.
+
+initial release.
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/h323.conf.xml
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/h323.conf.xml (from rev 15313, freeswitch/trunk/src/mod/endpoints/mod_h323/h323.conf.xml) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/h323.conf.xml (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/h323.conf.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,23 @@
+<configuration name="h323.conf" description="H323 Endpoints">
+ <settings>
+ <param name="trace-level" value="10"/>
+ <param name="context" value="default"/>
+ <param name="dialplan" value="XML"/>
+ <param name="codec-prefs" value="PCMA,GSM,G729,G726"/>
+ <param name="gk-address" value=""/> <!-- empty to disable, "*" to search LAN -->
+ <param name="gk-identifer" value=""/> <!-- optional name of gk -->
+ <param name="gk-interface" value=""/> <!-- mandatory listener interface name -->
+ <param name="gk-retry" value="30"/> <!-- optional GK register retry timer -->
+ <param name="faststart" value="true"/> <!-- optional -->
+ <param name="h245tunneling" value="true"/> <!-- optional -->
+ <param name="h245insetup" value="true"/> <!-- optional -->
+ <param name="jitter-size" value="60"/> <!-- optional -->
+ </settings>
+ <listeners>
+ <listener name="default">
+ <param name="h323-ip" value="$${local_ip_v4}"/>
+ <param name="h323-port" value="1720"/>
+ </listener>
+ </listeners>
+</configuration>
+
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/mod_h323.cpp
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/mod_h323.cpp (from rev 15313, freeswitch/trunk/src/mod/endpoints/mod_h323/mod_h323.cpp) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/mod_h323.cpp (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/mod_h323.cpp 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,1453 @@
+/*
+ Version 0.0.11
+*/
+
+#include "mod_h323.h"
+
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, mod_h323_globals.codec_string);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_context, mod_h323_globals.context);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, mod_h323_globals.dialplan);
+
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_h323_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_h323_shutdown);
+SWITCH_MODULE_DEFINITION(mod_h323, mod_h323_load, mod_h323_shutdown, NULL);
+
+#define CF_NEED_FLUSH (1 << 1)
+struct mod_h323_globals mod_h323_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 const char modulename[] = "h323";
+static const char* h323_formats[] = {
+ "G.711-ALaw-64k", "PCMA",
+ "G.711-uLaw-64k", "PCMU",
+ "GSM-06.10", "GSM",
+ "G.723", "G723",
+ "G.729B", "G729b",
+ "G.729", "G729",
+ "G.729A", "G729a",
+ "G.729A/B", "G729ab",
+ "G.723.1", "G723.1",
+ "G.723.1(5.3k)", "G723.1-5k3",
+ "G.723.1A(5.3k)", "G723.1a-5k3",
+ "G.723.1A(6.3k)", "G723.1a-6k3",
+ 0
+};
+
+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 h323fs_io_routines = {
+ /*.outgoing_channel */ create_outgoing_channel,
+ /*.read_frame */ FSH323Connection::read_audio_frame,
+ /*.write_frame */ FSH323Connection::write_audio_frame,
+ /*.kill_channel */ FSH323Connection::kill_channel,
+ /*.send_dtmf */ FSH323Connection::send_dtmf,
+ /*.receive_message */ FSH323Connection::receive_message,
+ /*.receive_event */ FSH323Connection::receive_event,
+ /*.state_change */ FSH323Connection::state_change,
+ /*.read_video_frame */ FSH323Connection::read_video_frame,
+ /*.write_video_frame */ FSH323Connection::write_video_frame
+};
+
+static switch_state_handler_table_t h323fs_event_handlers = {
+ /*.on_init */ FSH323Connection::on_init,
+ /*.on_routing */ FSH323Connection::on_routing,
+ /*.on_execute */ FSH323Connection::on_execute,
+ /*.on_hangup */ on_hangup,
+ /*.on_exchange_media */ FSH323Connection::on_exchange_media,
+ /*.on_soft_execute */ FSH323Connection::on_soft_execute,
+ /*.on_consume_media*/ NULL,
+ /*.on_hibernate*/ NULL,
+ /*.on_reset*/ NULL,
+ /*.on_park*/ NULL,
+ /*.on_reporting*/ NULL,
+ /*.on_destroy*/ on_destroy
+};
+
+static FSProcess *opal_process = NULL;
+SWITCH_MODULE_LOAD_FUNCTION(mod_h323_load){
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Starting loading mod_h323\n");
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+ if (!*module_interface) {
+ return SWITCH_STATUS_MEMERR;
+ }
+
+ h323_process = new FSProcess();
+ if (h323_process == NULL) {
+ return SWITCH_STATUS_MEMERR;
+ }
+
+ if (h323_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 h323_process;
+ h323_process = NULL;
+ return SWITCH_STATUS_FALSE;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_h323_shutdown){
+
+ switch_safe_free(mod_h323_globals.context);
+ switch_safe_free(mod_h323_globals.dialplan);
+ switch_safe_free(mod_h323_globals.codec_string);
+ delete h323_process;
+ h323_process = NULL;
+ return SWITCH_STATUS_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
+
+PString GetH245CodecName(const H323Capability* cap){
+
+ switch (cap->GetSubType()) {
+ case H245_AudioCapability::e_g711Alaw64k:
+ case H245_AudioCapability::e_g711Alaw56k:
+ return "PCMA";
+ case H245_AudioCapability::e_g711Ulaw64k:
+ case H245_AudioCapability::e_g711Ulaw56k:
+ return "PCMU";
+ case H245_AudioCapability::e_g722_64k:
+ case H245_AudioCapability::e_g722_56k:
+ case H245_AudioCapability::e_g722_48k:
+ return "G722";
+ case H245_AudioCapability::e_g728:
+ return "G728";
+ case H245_AudioCapability::e_g729:
+ case H245_AudioCapability::e_g729AnnexA:
+ case H245_AudioCapability::e_g729wAnnexB:
+ case H245_AudioCapability::e_g729AnnexAwAnnexB:
+ return "G729";
+ case H245_AudioCapability::e_g7231:
+ case H245_AudioCapability::e_g7231AnnexCCapability:
+ return "G723";
+ case H245_AudioCapability::e_gsmFullRate:
+ case H245_AudioCapability::e_gsmHalfRate:
+ case H245_AudioCapability::e_gsmEnhancedFullRate:
+ return "GSM";
+ }
+ return "Unknown";
+}
+
+FSProcess::FSProcess()
+ : PLibraryProcess("Test", "mod_h323", 1, 0, AlphaCode, 1)
+ , m_h323endpoint(NULL){
+}
+
+FSProcess::~FSProcess(){
+ delete m_h323endpoint;
+}
+
+bool FSProcess::Initialise(switch_loadable_module_interface_t *iface){
+ PTRACE(4, "mod_h323\t======>FSProcess::Initialise " << *this);
+
+ m_h323endpoint = new FSH323EndPoint();
+ return m_h323endpoint != NULL && m_h323endpoint->Initialise(iface);
+}
+
+bool FSH323EndPoint::Initialise(switch_loadable_module_interface_t *iface){
+ PTRACE(4, "mod_h323\t======>FSManager::Initialise " << *this);
+ ReadConfig(false);
+
+ PTrace::SetLevel(mod_h323_globals.trace_level); //just for fun and eyecandy ;)
+ PTrace::SetOptions(PTrace::TraceLevel);
+ PTrace::SetStream(new FSTrace);
+
+ m_freeswitch = (switch_endpoint_interface_t *) switch_loadable_module_create_interface(iface, SWITCH_ENDPOINT_INTERFACE);
+ m_freeswitch->interface_name = modulename;
+ m_freeswitch->io_routines = &h323fs_io_routines;
+ m_freeswitch->state_handler = &h323fs_event_handlers;
+
+ PString codec = ((const char *)mod_h323_globals.codec_string);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Config capabilliti %s \n",(const char *)codec);
+
+ if (!codec.IsEmpty()) {
+ const char** f = h323_formats;
+ for (; *f; f += 2) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Find capabilliti %s to %s\n",f[1],(const char *)codec);
+ if (codec.Find(f[1]) != P_MAX_INDEX) {
+ PString tmp = f[0];
+ tmp += "*{sw}";
+ PINDEX init = GetCapabilities().GetSize();
+ AddAllCapabilities(0, 0, tmp);
+ PINDEX num = GetCapabilities().GetSize() - init;
+ if (!num) {
+ // failed to add so pretend we support it in hardware
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "H323 failed to add capability '%s' \n",(const char *)tmp);
+ tmp = f[0];
+ tmp += "*{hw}";
+ AddAllCapabilities(0, 0, tmp);
+ num = GetCapabilities().GetSize() - init;
+ }
+ if (num)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "H.323 added %d capabilities '%s' \n",num,(const char *)tmp);
+ else
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "H323 failed to add capability '%s' \n",(const char *)tmp);
+
+ }
+ }
+ }
+
+
+ AddAllUserInputCapabilities(0,1);
+ PTRACE(1, "OpenPhone\tCapability Table:\n" << setprecision(4) << capabilities);
+
+ DisableFastStart(!m_faststart);
+ DisableH245Tunneling(!m_h245tunneling);
+ DisableH245inSetup(!m_h245insetup);
+
+ if (m_listeners.empty()) {
+ StartListener("");
+ } else {
+ for (std::list < FSListener >::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) {
+ if (!StartListener(it->listenAddress)) {
+ PTRACE(3, "mod_h323\tCannot start listener for " << it->name);
+ }
+ }
+ }
+
+ if (!m_gkAddress.IsEmpty() && !m_gkIdentifer.IsEmpty() && !m_gkInterface.IsEmpty()) {
+ m_thread = new FSGkRegThread(this,&m_gkAddress,&m_gkIdentifer,&m_gkInterface,m_gkretry);
+ m_thread->SetAutoDelete();
+ m_thread->Resume();
+ }
+
+ return TRUE;
+}
+
+switch_status_t FSH323EndPoint::ReadConfig(int reload){
+ PTRACE(4, "mod_h323\t======>FSH323EndPoint::ReadConfig " << *this);
+ const char *cf = "h323.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(¶ms, 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_h323_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{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set zero Jitter buffer\n");
+ SetAudioJitterDelay(0, 0);
+ }
+ } else if (!strcasecmp(var, "faststart")) {
+ m_faststart = switch_true(val);
+ } else if (!strcasecmp(var, "h245tunneling")) {
+ m_h245tunneling = switch_true(val);
+ } else if (!strcasecmp(var, "h245insetup")) {
+ m_h245insetup = switch_true(val);
+ } 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;
+ } else if (!strcasecmp(var, "gk-prefix")) {
+ m_gkPrefixes.AppendString(val);
+ } else if (!strcasecmp(var, "gk-retry")) {
+ m_gkretry = atoi(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");
+
+ if (!strcasecmp(var, "h323-ip"))
+ ip = val;
+ else if (!strcasecmp(var, "h323-port"))
+ port = (WORD) atoi(val);
+ }
+
+ listener.listenAddress = new H323ListenerTCP(*this,ip,port);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created Listener '%s'\n", (const char *) listener.name);
+ }
+ }
+
+ switch_event_destroy(¶ms);
+
+ if (xml)
+ switch_xml_free(xml);
+
+ return status;
+}
+
+FSH323EndPoint::FSH323EndPoint()
+ :m_faststart(true)
+ ,m_h245tunneling(true)
+ ,m_h245insetup(true)
+{
+ PTRACE(4, "mod_h323\t======>FSH323EndPoint::FSH323EndPoint [" << *this<<"]");
+ terminalType = e_GatewayOnly;
+}
+
+FSH323EndPoint::~FSH323EndPoint(){
+ PTRACE(4, "mod_h323\t======>FSH323EndPoint::~FSH323EndPoint [" << *this<<"]");
+ StopGkClient();
+}
+
+H323Connection *FSH323EndPoint::CreateConnection(
+ unsigned callReference,
+ void* userData,
+ H323Transport* transport,
+ H323SignalPDU* setupPDU){
+ PTRACE(4, "mod_h323\t======>FSH323EndPoint::CreateConnection callReference = "<< callReference <<" userDate = "<<userData<<" [" << *this<<"]");
+
+ if ((switch_caller_profile_t *)userData){
+ PTRACE(4, "mod_h323\t------> SWITCH_CALL_DIRECTION_OUTBOUND");
+ } else{
+ PTRACE(4, "mod_h323\t------> SWITCH_CALL_DIRECTION_INBOUND");
+ }
+
+ switch_core_session_t *fsSession = switch_core_session_request(GetSwitchInterface(),
+ (switch_caller_profile_t *)userData ? SWITCH_CALL_DIRECTION_OUTBOUND : SWITCH_CALL_DIRECTION_INBOUND, NULL);
+ if (fsSession == NULL)
+ return NULL;
+
+ PTRACE(4, "mod_h323\t------> fsSession = "<<fsSession);
+ switch_channel_t *fsChannel = switch_core_session_get_channel(fsSession);
+
+ if (fsChannel == NULL) {
+ switch_core_session_destroy(&fsSession);
+ return NULL;
+ }
+
+ return new FSH323Connection(*this,transport,callReference,(switch_caller_profile_t *)userData, fsSession, fsChannel);
+}
+
+bool FSH323EndPoint::OnSetGatewayPrefixes(PStringList & prefixes) const{
+ PTRACE(4, "mod_h323\t======>FSH323EndPoint::OnSetGatewayPrefixes " << *this);
+ if(m_gkPrefixes.GetSize() > 0) {
+ PTRACE(4, "mod_h323\tOnSetGatewayPrefixes " << m_gkPrefixes);
+ prefixes = m_gkPrefixes;
+ return true;
+ }
+ return false;
+}
+
+void FSH323EndPoint::StartGkClient(int retry, PString* gkAddress,PString* gkIdentifer,PString* gkInterface){
+ PTRACE(4, "mod_h323\t======>FSH323EndPoint::StartGkClient [" << *this<<"]");
+ while(!UseGatekeeper(m_gkAddress, m_gkIdentifer, m_gkInterface) && retry > 0 ){
+ 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);
+ switch_yield(retry*1000);
+ }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Started gatekeeper: %s\n",
+ (const char *)GetGatekeeper()->GetName());
+ m_thread = 0;
+}
+
+void FSH323EndPoint::StopGkClient(){
+ PTRACE(4, "mod_h323\t======> FSH323EndPoint::StopGkClient [" << *this<<"]");
+ if (m_thread) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Started gatekeeper thread\n");
+ RemoveGatekeeper();
+ m_thread->Terminate();
+ m_thread = 0;
+ }
+}
+
+FSH323Connection::FSH323Connection(FSH323EndPoint& endpoint, H323Transport* transport, unsigned callReference, switch_caller_profile_t *outbound_profile, switch_core_session_t *fsSession, switch_channel_t *fsChannel)
+ : H323Connection(endpoint,callReference)
+ , m_endpoint(&endpoint)
+ , m_fsSession(fsSession)
+ , m_fsChannel(fsChannel)
+ , m_callOnPreAnswer(false)
+ , m_startRTP(false)
+ , m_rxChennel(false)
+ , m_txChennel(false)
+ , m_ChennelAnswer(false)
+ , m_ChennelProgress(false){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::FSH323Connection [" << *this<<"]");
+
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_alloc(m_fsSession, sizeof(*tech_pvt));
+ tech_pvt->me = this;
+ switch_core_session_set_private(m_fsSession, tech_pvt);
+
+ switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(m_fsSession));
+ switch_mutex_init(&tech_pvt->h323_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(m_fsSession));
+
+ 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 = "h323/";
+ 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);
+ }
+
+ m_RTPlocalPort = switch_rtp_request_port((const char *)m_RTPlocalIP.AsString());
+}
+
+FSH323Connection::~FSH323Connection(){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::~FSH323Connection ["<<*this<<"]");
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(m_fsSession);
+ tech_pvt->me = NULL;
+}
+
+void FSH323Connection::OnSetLocalCapabilities(){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::OnSetLocalCapabilities() [" << *this<<"]");
+ H323Connection::OnSetLocalCapabilities();
+ SetLocalCapabilities();
+}
+
+bool FSH323Connection::SetLocalCapabilities(){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::SetLocalCapabilities() Size local capability = "<<localCapabilities.GetSize()<<" [" << *this<<"]");
+ if (!mod_h323_globals.codec_string)
+ return false;
+
+ bool nocodecs = true;
+ bool changed = false;
+ for (int i = 0; i < localCapabilities.GetSize(); i++) {
+ const char* format = 0;
+ PString fname;
+ decodeCapability(localCapabilities[i],&format,0,&fname);
+ if (format) {
+ PString m_globalcodec = ((const char *)mod_h323_globals.codec_string);
+ if (m_globalcodec.Find(format) < 0) {
+ PTRACE(1, "mod_h323\tRemoving capability '"<<fname<<"' ("<<format<<") not in remote '"<<m_globalcodec<<"'");
+ changed = true;
+ for (PINDEX idx = 0; idx < fastStartChannels.GetSize(); idx++) {
+ if (fastStartChannels[idx].GetCapability() == localCapabilities[i]) {
+ PTRACE(1, "mod_h323\tRemoving fast start channel "<<fastStartChannels[idx].GetDirection()<<" '"<<fname<<"' ("<<format<<")");
+ fastStartChannels.RemoveAt(idx--);
+ }
+ }
+ localCapabilities.Remove(fname);
+ i--;
+ } else nocodecs = false;
+ }
+ }
+ if (nocodecs) {
+ PTRACE(3, "mod_h323\tNo codecs remaining for H323 connection ["<<*this<<"]");
+ changed = false;
+ ClearCall(EndedByCapabilityExchange);
+ }
+ return changed;
+}
+
+bool FSH323Connection::decodeCapability(const H323Capability& capability, const char** dataFormat, int* payload, PString* capabName){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::decodeCapability");
+ PString fname((const char *)capability.GetFormatName());
+
+ if (fname.Find("{sw}") == (fname.GetLength() - 4))
+ fname = fname.Mid(0,fname.GetLength()-4);
+ if (fname.Find("{hw}") == (fname.GetLength() - 4))
+ fname = fname.Mid(0,fname.GetLength()-4);
+
+ OpalMediaFormat oformat(fname, false);
+ int pload = oformat.GetPayloadType();
+ const char *format = 0;
+ const char** f = h323_formats;
+ for (; *f; f += 2) {
+ if (fname.Find(*f) == 0) {
+ format = f[1];
+ break;
+ }
+ }
+
+ PTRACE(1, "mod_h323\tcapability '"<< fname << "' format '"<<format<<"' payload "<<pload);
+ if (format) {
+ if (capabName)
+ *capabName = fname;
+ if (dataFormat)
+ *dataFormat = format;
+ if (payload)
+ *payload = pload;
+ return true;
+ }
+ return false;
+}
+
+H323Connection::AnswerCallResponse FSH323Connection::OnAnswerCall(const PString &caller,
+ const H323SignalPDU &setupPDU, H323SignalPDU &connectPDU){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::OnAnswerCall caller = "<< caller<<" [" << *this<<"]");
+
+ if (m_fsSession == NULL) {
+ PTRACE(1, "mod_h323\tSession request failed.");
+ return H323Connection::AnswerCallDenied;
+ }
+
+ 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_h323\tSession does not have a channel");
+ return H323Connection::AnswerCallDenied;
+ }
+
+ const Q931& q931 = setupPDU.GetQ931();
+ const H225_Setup_UUIE& setup = setupPDU.m_h323_uu_pdu.m_h323_message_body;
+ const H225_ArrayOf_AliasAddress& address = setup.m_destinationAddress;
+ for (int i = 0; i<address.GetSize(); i++)
+ PTRACE(2, "mod_h323\t address index = "<<i<<" value = "<<(const char *)H323GetAliasAddressString(address[i]));
+ PString called;
+ if (address.GetSize() > 0)
+ called = (const char *)H323GetAliasAddressString(address[0]);
+ if (!called.IsEmpty())
+ PTRACE(2, "mod_h323\t Called number or alias = "<<called);
+ else {
+ PString callnam;
+ if (q931.GetCalledPartyNumber(callnam)) {
+ called=(const char *)callnam;
+ PTRACE(2, "mod_h323\t Called-Party-Number = "<<called);
+ }
+ }
+
+ switch_caller_profile_t *caller_profile = switch_caller_profile_new(switch_core_session_get_pool(m_fsSession),
+ NULL,
+ /** username */
+ mod_h323_globals.dialplan,
+ /** dial plan */
+ GetRemotePartyName(),
+ /** caller_id_name */
+ GetRemotePartyNumber(),
+ /** caller_id_number */
+ NULL,
+ /** network addr */
+ NULL,
+ /** ANI */
+ NULL,
+ /** ANI II */
+ NULL,
+ /** RDNIS */
+ modulename,
+ /** source */
+ mod_h323_globals.context,
+ /** set context */
+ called
+ /** destination_number */
+ );
+ if (caller_profile == NULL) {
+ PTRACE(1, "mod_h323\tCould not create caller profile");
+ return H323Connection::AnswerCallDenied;
+ }
+
+ PTRACE(4, "mod_h323\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] = "h323/";
+ switch_copy_string(name + 5, caller_profile->destination_number, sizeof(name)-5);
+ 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_h323\tCould not launch session thread");
+ return H323Connection::AnswerCallDenied;
+ }
+
+ return H323Connection::AnswerCallDeferred;
+}
+
+H323Channel* FSH323Connection::CreateRealTimeLogicalChannel(const H323Capability& capability,H323Channel::Directions dir,unsigned sessionID,const H245_H2250LogicalChannelParameters* param, RTP_QOS * rtpqos){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::CreateRealTimeLogicalChannel [" << *this<<"]");
+
+ H323TransportAddress m_h323transportadd = GetSignallingChannel()->GetLocalAddress();
+ m_h323transportadd.GetIpAddress(m_RTPlocalIP);
+
+ return new FSH323_ExternalRTPChannel(*this, capability, dir, sessionID,m_RTPlocalIP,m_RTPlocalPort);
+}
+
+PBoolean FSH323Connection::OnStartLogicalChannel(H323Channel & channel){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::OnStartLogicalChannel chennel = "<<&channel<<" ["<<*this<<"]");
+
+ return true;
+}
+
+PBoolean FSH323Connection::OnCreateLogicalChannel(const H323Capability& capability, H323Channel::Directions dir, unsigned& errorCode){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::OnCreateLogicalChannel ('"<< (const char *)capability.GetFormatName()<<"',"<<dir<<") ["<<*this<<"]");
+
+ return H323Connection::OnCreateLogicalChannel(capability,dir,errorCode);
+}
+
+void FSH323Connection::OnReceivedReleaseComplete(const H323SignalPDU & pdu){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::OnReceivedReleaseComplete cause = "<<pdu.GetQ931().GetCause()<<" value = "<<(switch_call_cause_t)pdu.GetQ931().GetCause());
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(m_fsSession);
+
+ switch_channel_hangup(switch_core_session_get_channel(m_fsSession),(switch_call_cause_t)pdu.GetQ931().GetCause());
+ return H323Connection::OnReceivedReleaseComplete(pdu);
+}
+
+bool FSH323Connection::OnReceivedProgress(const H323SignalPDU &pdu)
+{
+ PTRACE(4, "mod_h323\t======>FSH323Connection::OnReceivedProgress ["<<*this<<"]");
+ if ((m_rxChennel && m_txChennel) || (m_ChennelProgress && m_rxChennel))
+ switch_channel_mark_pre_answered(m_fsChannel);
+ else{
+ m_ChennelProgress = true;
+ }
+ 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());
+
+ switch_channel_hangup(m_fsChannel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ return H323Connection::OnSendReleaseComplete(pdu);
+}
+
+PBoolean FSH323Connection::OpenLogicalChannel(const H323Capability& capability, unsigned sessionID, H323Channel::Directions dir){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::OpenLogicalChannel ('"<< (const char *)capability.GetFormatName()<<"', "<< sessionID<<", "<<dir <<") "<<*this);
+
+ return H323Connection::OpenLogicalChannel(capability,sessionID,dir);
+}
+
+
+bool FSH323Connection::OnReceivedCapabilitySet(const H323Capabilities & remoteCaps,
+ const H245_MultiplexCapability * muxCap,
+ H245_TerminalCapabilitySetReject & reject){
+
+ PTRACE(4, "mod_h323\t======>FSH323Connection::OnReceivedCapabilitySet ["<<*this<<"]");
+ if (!H323Connection::OnReceivedCapabilitySet(remoteCaps, muxCap, reject)) {
+ return false;
+ }
+ PTRACE(4, "mod_h323\t======>END H323Connection::OnReceivedCapabilitySet ["<<*this<<"]");
+
+ for (int i = 0; i < remoteCapabilities.GetSize(); ++i) {
+ PTRACE(4, "mod_h323\t----> Capabilities = "<<remoteCapabilities[i]);
+ }
+
+ H323Capability * cap = remoteCapabilities.FindCapability(H323Capability::e_Audio);
+ if (cap == NULL) {
+ PTRACE(4, "mod_h323\t----> Capabilities is NULL ");
+ return false;
+ }
+ PTRACE(4, "mod_h323\t----> Capabilities not NULL ");
+
+ return true;
+}
+
+
+bool FSH323Connection::OnAlerting(const H323SignalPDU &alertingPDU, const PString &user){
+
+ PTRACE(4, "mod_h323\t======>PFSH323Connection::OnAlerting user = "<<(const char *)user<<" ["<<*this<<"]");
+ switch_status_t status = switch_channel_mark_ring_ready(m_fsChannel);
+ PTRACE(4, "mod_h323\t----------->OnAlerting return = "<<status);
+ return ( status == SWITCH_STATUS_SUCCESS);
+}
+
+void FSH323Connection::OnEstablished(){
+
+ PTRACE(4, "mod_h323\t======>PFSH323Connection::OnEstablished ["<<*this<<"]");
+ if(m_startRTP)
+ switch_channel_mark_answered(m_fsChannel);
+ else m_ChennelAnswer = true;
+}
+
+
+
+void FSH323Connection::setRemoteAddress(const char* remoteIP, WORD remotePort){
+ PTRACE(4, "mod_h323\t======>PFSH323Connection::setRemoteAddress remoteIP ="<<remoteIP<<", remotePort = "<<remotePort<<" "<<*this);
+
+ if (!m_remotePort) {
+ PTRACE(4, "mod_h323\tGot remote RTP address "<<remoteIP<<":"<<remotePort<<" ["<<*this<<"]");
+ m_remotePort = remotePort;
+ m_remoteAddr = remoteIP;
+ }
+}
+
+switch_status_t FSH323Connection::on_execute(){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::on_execute [" << *this<<"]");
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSH323Connection::on_routing(){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::on_routing ["<< *this<<"]");
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSH323Connection::kill_channel(int sig){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::kill_channel ["<< *this<<"]");
+ PTRACE(3, "mod_h323\tKill " << sig << " on connection " << *this);
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(m_fsSession);
+
+ if (!tech_pvt) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ switch (sig) {
+ case SWITCH_SIG_BREAK:
+ if (switch_rtp_ready(tech_pvt->rtp_session)) {
+ switch_rtp_break(tech_pvt->rtp_session);
+ }
+ break;
+ case SWITCH_SIG_KILL:
+ default:
+ if (switch_rtp_ready(tech_pvt->rtp_session)) {
+ switch_rtp_kill_socket(tech_pvt->rtp_session);
+ }
+ break;
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSH323Connection::send_dtmf(const switch_dtmf_t *dtmf){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::send_dtmf " << *this);
+ SendUserInputTone(dtmf->digit, dtmf->duration);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+void FSH323Connection::SendUserInputTone(char tone, unsigned duration, unsigned logicalChannel, unsigned rtpTimestamp)
+{
+ PTRACE(4, "mod_h323\t======>FSH323Connection::SendUserInputTone [" << *this<<"]");
+ H323Connection::SendUserInputTone(tone, duration);
+}
+
+void FSH323Connection::OnUserInputTone(char tone, unsigned duration, unsigned logicalChannel, unsigned rtpTimestamp)
+{
+ PTRACE(4, "mod_h323\t======>FSH323Connection::OnUserInputTone [" << *this<<"]");
+
+ switch_dtmf_t dtmf = { tone, duration };
+ switch_channel_queue_dtmf(m_fsChannel, &dtmf);
+ H323Connection::OnUserInputTone( tone, duration, logicalChannel, rtpTimestamp);
+}
+
+void FSH323Connection::OnUserInputString(const PString &value)
+{
+ PTRACE(4, "mod_h323\t======>FSH323Connection::OnUserInputString [" << *this<<"]");
+ switch_dtmf_t dtmf = { value[0], 0 };
+ switch_channel_queue_dtmf(m_fsChannel, &dtmf);
+ H323Connection::OnUserInputString(value);
+}
+
+
+switch_status_t FSH323Connection::receive_message(switch_core_session_message_t *msg){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::receive_message MSG=" << msg->message_id);
+ switch_channel_t *channel = switch_core_session_get_channel(m_fsSession);
+
+ 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;
+ default:
+ break;
+ }
+
+ switch (msg->message_id) {
+ case SWITCH_MESSAGE_INDICATE_RINGING:{
+ AnsweringCall(AnswerCallPending);
+ break;
+ }
+ case SWITCH_MESSAGE_INDICATE_DEFLECT:{
+ break;
+ }
+ case SWITCH_MESSAGE_INDICATE_PROGRESS:{
+ AnsweringCall(AnswerCallPending);
+ AnsweringCall(AnswerCallDeferredWithMedia);
+
+ 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;
+ break;
+ }
+ 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 (!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;
+ break;
+ }
+ default:{
+ PTRACE(3, "mod_h323\tReceived message " << msg->message_id << " on connection " << *this);
+ }
+ }
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSH323Connection::receive_event(switch_event_t *event){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::receive_event " << *this);
+ PTRACE(3, "mod_h323\tReceived event " << event->event_id << " on connection " << *this);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSH323Connection::state_change(){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::state_change " << *this);
+ PTRACE(3, "mod_h323\tState changed on connection " << *this);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSH323Connection::on_init(){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::on_init " << *this);
+ switch_channel_t *channel = switch_core_session_get_channel(m_fsSession);
+ if (channel == NULL) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ PTRACE(3, "mod_h323\tStarted routing for connection " << *this);
+ switch_channel_set_state(channel, CS_ROUTING);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSH323Connection::on_exchange_media(){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::on_exchange_media " << *this);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSH323Connection::on_soft_execute(){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::on_soft_execute " << *this);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSH323Connection::read_audio_frame(switch_frame_t **frame, switch_io_flag_t flags, int stream_id){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::read_audio_frame " << *this);
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(m_fsSession);
+ tech_pvt->read_frame.flags = 0;
+
+ switch_set_flag_locked(tech_pvt, TFLAG_READING);
+ if (!switch_channel_ready(m_fsChannel)) {
+ PTRACE(4, "mod_h323\t---------> RETURN");
+ switch_clear_flag_locked(tech_pvt, TFLAG_READING);
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (!switch_core_codec_ready(&tech_pvt->read_codec )) {
+ PTRACE(4, "mod_h323\t---------> RETURN");
+ switch_clear_flag_locked(tech_pvt, TFLAG_READING);
+ return SWITCH_STATUS_FALSE;
+ }
+
+ switch_status_t status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame, flags);
+ if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
+ PTRACE(4, "mod_h323\t---------> RETURN");
+ switch_clear_flag_locked(tech_pvt, TFLAG_READING);
+ return SWITCH_STATUS_FALSE;
+ }
+ PTRACE(4, "mod_h323\t--------->\n source = "<<tech_pvt->read_frame.source<< "\n packetlen = "<<tech_pvt->read_frame.packetlen<<"\n datalen = "<<tech_pvt->read_frame.datalen<<"\n samples = "<<tech_pvt->read_frame.samples<<"\n rate = "<<tech_pvt->read_frame.rate<<"\n payload = "<<(int)tech_pvt->read_frame.payload<<"\n timestamp = "<<tech_pvt->read_frame.timestamp<<"\n seq = "<<tech_pvt->read_frame.seq<<"\n ssrc = "<<tech_pvt->read_frame.ssrc);
+ if (tech_pvt->read_frame.flags & SFF_CNG) {
+ tech_pvt->read_frame.buflen = sizeof(m_buf);
+ tech_pvt->read_frame.data = m_buf;
+ tech_pvt->read_frame.packet = NULL;
+ tech_pvt->read_frame.packetlen = 0;
+ tech_pvt->read_frame.timestamp = 0;
+ tech_pvt->read_frame.m = SWITCH_FALSE;
+ tech_pvt->read_frame.seq = 0;
+ tech_pvt->read_frame.ssrc = 0;
+ tech_pvt->read_frame.codec = &tech_pvt->read_codec ;
+ } else {
+ tech_pvt->read_frame.codec = &tech_pvt->read_codec ;
+ }
+ switch_clear_flag_locked(tech_pvt, TFLAG_READING);
+
+ *frame = &tech_pvt->read_frame;
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSH323Connection::write_audio_frame(switch_frame_t *frame, switch_io_flag_t flags, int stream_id){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::write_audio_frame " << *this);
+
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(m_fsSession);
+ switch_assert(tech_pvt != NULL);
+
+ if (!switch_channel_ready(m_fsChannel)) {
+ PTRACE(4, "mod_h323\t---------> RETURN");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) {
+ if (switch_channel_ready(m_fsChannel)) {
+ switch_yield(10000);
+ } else {
+ PTRACE(4, "mod_h323\t---------> RETURN");
+ return SWITCH_STATUS_GENERR;
+ }
+ }
+
+ if (!switch_core_codec_ready(&tech_pvt->read_codec) || !tech_pvt->read_codec.implementation) {
+ PTRACE(4, "mod_h323\t---------> RETURN");
+ return SWITCH_STATUS_GENERR;
+ }
+
+ if ((frame->flags & SFF_CNG)) {
+ PTRACE(4, "mod_h323\t---------> RETURN");
+ return SWITCH_STATUS_SUCCESS;
+ }
+ switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
+
+ if (switch_rtp_write_frame(tech_pvt->rtp_session, frame)< 0) {
+ status = SWITCH_STATUS_GENERR;
+ }
+
+ switch_clear_flag_locked(tech_pvt, TFLAG_WRITING);
+ PTRACE(4, "mod_h323\t---------> RETURN");
+ return status;
+}
+
+switch_status_t FSH323Connection::read_video_frame(switch_frame_t **frame, switch_io_flag_t flag, int stream_id){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::read_video_frame " << *this);
+
+}
+
+switch_status_t FSH323Connection::write_video_frame(switch_frame_t *frame, switch_io_flag_t flag, int stream_id){
+ PTRACE(4, "mod_h323\t======>FSH323Connection::write_video_frame " << *this);
+}
+
+///////////////////////////////////////////////////////////////////////
+
+FSH323_ExternalRTPChannel::FSH323_ExternalRTPChannel(
+ FSH323Connection& connection,
+ const H323Capability& capability,
+ Directions direction,
+ unsigned sessionID,
+ const PIPSocket::Address& ip,
+ WORD dataPort)
+ : H323_ExternalRTPChannel(connection, capability, direction, sessionID,ip,dataPort)
+ , m_conn(&connection)
+ , m_fsSession(connection.GetSession())
+ , m_capability(&capability)
+ , m_RTPlocalPort(dataPort){
+
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(m_fsSession);
+ m_RTPlocalIP = (const char *)ip.AsString();
+ SetExternalAddress(H323TransportAddress(ip, dataPort), H323TransportAddress(ip, dataPort+1));
+ PTRACE(4, "mod_h323\t======>FSH323_ExternalRTPChannel::FSH323_ExternalRTPChannel "<< GetDirection()<< " addr="<< m_RTPlocalIP <<":"<< m_RTPlocalPort<<" ["<<*this<<"]");
+
+ memset(&m_readFrame, 0, sizeof(m_readFrame));
+ m_readFrame.codec = m_switchCodec;
+ m_readFrame.flags = SFF_RAW_RTP;
+
+ m_fsChannel = switch_core_session_get_channel(m_fsSession);
+ //SetExternalAddress(H323TransportAddress(localIpAddress, m_RTPlocalPort), H323TransportAddress(localIpAddress, m_RTPlocalPort+1));
+ PTRACE(4, "mod_h323\t------->capability.GetPayloadType() return = "<<capability.GetPayloadType());
+ PTRACE(4, "mod_h323\t------->capability.GetFormatName() return = "<<capability.GetFormatName());
+
+ PString fname((const char *)capability.GetFormatName());
+
+ if (fname.Find("{sw}") == (fname.GetLength() - 4))
+ fname = fname.Mid(0,fname.GetLength()-4);
+ if (fname.Find("{hw}") == (fname.GetLength() - 4))
+ fname = fname.Mid(0,fname.GetLength()-4);
+
+ OpalMediaFormat format(fname, FALSE);
+ m_format = &format;
+ payloadCode = format.GetPayloadType();
+ PTRACE(4, "mod_h323\t------->payloadCode = "<<(int)payloadCode);
+}
+
+
+FSH323_ExternalRTPChannel::~FSH323_ExternalRTPChannel(){
+ PTRACE(4, "mod_h323\t======>FSH323_ExternalRTPChannel::~FSH323_ExternalRTPChannel "<< GetDirection()<<" "<<*this);
+
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(m_fsSession);
+ if (IsRunning()){
+ PTRACE(4, "mod_h323\t------------->Running");
+ if (switch_rtp_ready(tech_pvt->rtp_session)) {
+ switch_rtp_kill_socket(tech_pvt->rtp_session);
+ }
+ }
+}
+
+PBoolean FSH323_ExternalRTPChannel::Start(){
+ PTRACE(4, "mod_h323\t======>FSH323_ExternalRTPChannel::Start() "<<*this);
+
+ const char *err = NULL;
+ switch_rtp_flag_t flags;
+ char * timer_name = NULL;
+ const char *var;
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(m_fsSession);
+ if (!(m_conn && H323_ExternalRTPChannel::Start()))
+ return FALSE;
+
+ bool isAudio;
+ if (m_capability->GetMainType() == H323Capability::e_Audio) {
+ isAudio = true;
+ PTRACE(4, "mod_h323\t------------------------->H323Capability::e_Audio");
+ } else if (m_capability->GetMainType() == H323Capability::e_Video) {
+ isAudio = false;
+ PTRACE(4, "mod_h323\t------------------------->H323Capability::e_Video");
+ }
+
+ H323Codec *codec = GetCodec();
+
+ PTRACE(4, "mod_h323\t------------------->GetFrameSize() return = "<<m_format->GetFrameSize());
+ PTRACE(4, "mod_h323\t------------------->GetFrameTime() return = "<<m_format->GetFrameTime());
+ PTRACE(4, "mod_h323\t------------------->payloadCode = "<<(int)payloadCode);
+ PTRACE(4, "mod_h323\t------------------->m_capability->GetTxFramesInPacket() return = "<<m_capability->GetTxFramesInPacket());
+ PTRACE(4, "mod_h323\t------------------->m_capability->GetFormatName() return = "<<m_capability->GetFormatName());
+ PTRACE(4, "mod_h323\t------------------->GetH245CodecName() return = "<<GetH245CodecName(m_capability));
+
+ if (GetDirection() == IsReceiver){
+ m_switchCodec = isAudio ? &tech_pvt->read_codec : &tech_pvt->vid_read_codec;
+ m_switchTimer = isAudio ? &tech_pvt->read_timer : &tech_pvt->vid_read_timer;
+ m_conn->m_rxChennel = true;
+ }else{
+ m_switchCodec = isAudio ? &tech_pvt->write_codec : &tech_pvt->vid_write_codec;
+ m_conn->m_txChennel = true;
+ }
+
+ if (m_conn->m_callOnPreAnswer && !(GetDirection() == IsReceiver)){
+ m_switchCodec = isAudio ? &tech_pvt->read_codec : &tech_pvt->vid_read_codec;
+ m_switchTimer = isAudio ? &tech_pvt->read_timer : &tech_pvt->vid_read_timer;
+ }
+
+ if (switch_core_codec_init(m_switchCodec, GetH245CodecName(m_capability), NULL, // FMTP
+ 8000, m_capability->GetTxFramesInPacket(), 1, // Channels
+ SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, // Settings
+ switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
+
+ if (switch_core_codec_init(m_switchCodec, GetH245CodecName(m_capability), NULL, // FMTP
+ 8000, 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_h323\t" << switch_channel_get_name(m_fsChannel)<< " Cannot initialise " << ((GetDirection() == IsReceiver)? " read" : " write") << ' '
+ << m_capability->GetMainType() << " codec " << m_capability << " for connection " << *this);
+ switch_channel_hangup(m_fsChannel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
+ return false;
+ }
+ PTRACE(2, "mod_h323\t" << switch_channel_get_name(m_fsChannel)<< " Unsupported ptime of " << m_capability->GetTxFramesInPacket() << " on " << ((GetDirection() == IsReceiver)? " read" : " write") << ' '
+ << m_capability->GetMainType() << " codec " << m_capability << " for connection " << *this);
+ }
+
+ PTRACE(1, "mod_h323\t" << switch_channel_get_name(m_fsChannel)<< " initialise " <<
+ switch_channel_get_name(m_fsChannel) << ((GetDirection() == IsReceiver)? " read" : " write") << ' '
+ << m_capability->GetMainType() << " codec " << m_capability << " for connection " << *this);
+
+ if (GetDirection() == IsReceiver) {
+ m_readFrame.rate = tech_pvt->read_codec.implementation->actual_samples_per_second;
+
+ 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);
+ }
+ }
+
+ if (m_conn->m_callOnPreAnswer && !(GetDirection() == IsReceiver)){
+ m_readFrame.rate = tech_pvt->read_codec.implementation->actual_samples_per_second;
+
+ 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;
+ }
+ switch_channel_set_variable(m_fsChannel,"timer_name","soft");
+ }
+ }
+
+ if (m_conn->m_ChennelProgress && (GetDirection() == IsReceiver)){
+ if (isAudio) {
+ switch_core_session_set_write_codec(m_fsSession, m_switchCodec);
+ }
+ }
+
+ PTRACE(3, "mod_h323\tSet " << ((GetDirection() == IsReceiver)? " read" : " write") << ' '
+ << m_capability->GetMainType() << " codec to << " << m_capability << " for connection " << *this);
+
+ switch_mutex_lock(tech_pvt->h323_mutex);
+
+ PIPSocket::Address remoteIpAddress;
+ GetRemoteAddress(remoteIpAddress,m_RTPremotePort);
+ m_RTPremoteIP = (const char *)remoteIpAddress.AsString();
+ PTRACE(4, "mod_h323\t------------------->tech_pvt->rtp_session = "<<tech_pvt->rtp_session);
+ 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|SWITCH_RTP_FLAG_AUTOADJ);
+ if ((var = switch_channel_get_variable(m_fsChannel, "timer_name"))) {
+ timer_name = (char *) var;
+ }
+ tech_pvt->rtp_session = switch_rtp_new((const char *)m_RTPlocalIP,
+ m_RTPlocalPort,
+ (const char *)m_RTPremoteIP,
+ m_RTPremotePort,
+ (switch_payload_t)payloadCode,
+ m_switchCodec->implementation->samples_per_packet,
+ m_capability->GetTxFramesInPacket() * 1000,
+ (switch_rtp_flag_t) flags, timer_name, &err,
+ switch_core_session_get_pool(m_fsSession));
+ PTRACE(4, "mod_h323\t------------------------->tech_pvt->rtp_session = "<<tech_pvt->rtp_session);
+ m_conn->m_startRTP = true;
+ if (switch_rtp_ready(tech_pvt->rtp_session)) {
+ PTRACE(4, "mod_h323\t+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+ switch_channel_set_flag(m_fsChannel, CF_FS_RTP);
+
+ }else{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", switch_str_nil(err));
+ switch_channel_hangup(m_fsChannel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ switch_mutex_unlock(tech_pvt->h323_mutex);
+ return SWITCH_STATUS_FALSE;
+ }
+ }
+
+ PTRACE(4, "mod_h323\t------------->External RTP address "<<m_RTPremoteIP<<":"<<m_RTPremotePort);
+ switch_mutex_unlock(tech_pvt->h323_mutex);
+ if ( m_conn->m_ChennelAnswer && m_conn->m_rxChennel && m_conn->m_txChennel)
+ switch_channel_mark_answered(m_fsChannel);
+
+ if ((m_conn->m_ChennelProgress && m_conn->m_rxChennel)||(m_conn->m_callOnPreAnswer && m_conn->m_txChennel))
+ switch_channel_mark_pre_answered(m_fsChannel);
+
+ return true;
+}
+
+
+PBoolean FSH323_ExternalRTPChannel::OnReceivedPDU(
+ const H245_H2250LogicalChannelParameters& param,
+ unsigned& errorCode){
+ PTRACE(4, "mod_h323\t======>FSH323_ExternalRTPChannel::OnReceivedPDU ["<<*this<<"]");
+
+ if (!H323_ExternalRTPChannel::OnReceivedPDU(param,errorCode))
+ return true;
+ PIPSocket::Address remoteIpAddress;
+ WORD remotePort;
+ GetRemoteAddress(remoteIpAddress,remotePort);
+ PTRACE(4, "mod_h323\tRemote RTP address "<<(const char *)remoteIpAddress.AsString()<<":"<<remotePort);
+ m_conn->setRemoteAddress((const char *)remoteIpAddress.AsString(), remotePort);
+ return true;
+}
+
+PBoolean FSH323_ExternalRTPChannel::OnSendingPDU(H245_H2250LogicalChannelParameters& param){
+ PTRACE(4, "mod_h323\t======>FSH323_ExternalRTPChannel::OnSendingPDU ["<<*this<<"]");
+ return H323_ExternalRTPChannel::OnSendingPDU(param);
+}
+
+PBoolean FSH323_ExternalRTPChannel::OnReceivedAckPDU(const H245_H2250LogicalChannelAckParameters& param){
+ PTRACE(4, "mod_h323\t======>FSH323_ExternalRTPChannel::OnReceivedAckPDU ["<<*this<<"]");
+ return H323_ExternalRTPChannel::OnReceivedAckPDU(param);
+}
+
+void FSH323_ExternalRTPChannel::OnSendOpenAck(H245_H2250LogicalChannelAckParameters& param){
+ PTRACE(4, "mod_h323\t======>FSH323_ExternalRTPChannel::OnSendOpenAck ["<<*this<<"]");
+ H323_ExternalRTPChannel::OnSendOpenAck(param);
+}
+
+
+FSH323Connection * FSH323EndPoint::FSMakeCall(const PString & dest, void *userData){
+ PTRACE(4, "mod_h323\t======>FSH323EndPoint::FSMakeCall DST NUMBER = "<<dest<<" ["<<*this<<"]");
+
+ FSH323Connection * connection;
+ PString token;
+ H323Transport *transport = NULL;
+
+ if (listeners.GetSize() > 0) {
+ H323TransportAddress taddr = listeners[0].GetTransportAddress();
+ PIPSocket::Address addr;
+ WORD port;
+ if (taddr.GetIpAndPort(addr, port)) {
+ if (addr) {
+ PTRACE(4, "mod_h323\t----> Using "<<addr<<" for outbound call");
+ transport = new H323TransportTCP(*this, addr,false);
+ if (!transport)
+ PTRACE(4, "mod_h323\t----> Unable to create transport for outgoing call");
+ }
+ } else
+ PTRACE(4, "mod_h323\t----> Unable to get address and port");
+ }
+
+ if (!(connection = (FSH323Connection *)H323EndPoint::MakeCall(dest, token, userData))) {
+ return NULL;
+ }
+ return connection;
+}
+
+
+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){
+ PTRACE(4, "mod_h323\t======>create_outgoing_channel DST NUMBER = "<<outbound_profile->destination_number);
+
+ FSH323Connection * connection;
+ if (h323_process == NULL) {
+ return SWITCH_CAUSE_CRASH;
+ }
+ FSH323EndPoint & ep = h323_process->GetH323EndPoint();
+ if (!(connection = ep.FSMakeCall(outbound_profile->destination_number,outbound_profile))){
+ return SWITCH_CAUSE_PROTOCOL_ERROR;
+ }
+
+ *new_session = connection->GetSession();
+ PTRACE(4, "mod_h323\t--------->GetSession() return = "<<connection->GetSession());
+ return SWITCH_CAUSE_SUCCESS;
+}
+
+
+static switch_status_t on_destroy(switch_core_session_t *session){
+ PTRACE(4, "mod_h323\t======>on_destroy ");
+
+ h323_private_t *tech_pvt = (h323_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;
+}
+
+
+static switch_status_t on_hangup(switch_core_session_t *session){
+ PTRACE(4, "mod_h323\t======>switch_status_t on_hangup ");
+
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(session);
+ if (tech_pvt->me) {
+ PTRACE(4, "mod_h323\t----->");
+ 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;
+}
+
+
+
+
+
+
+
+
Deleted: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/mod_h323.h
Copied: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/mod_h323.h (from rev 15313, freeswitch/trunk/src/mod/endpoints/mod_h323/mod_h323.h) (0 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/mod_h323.h (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_h323/mod_h323.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -0,0 +1,465 @@
+
+
+#if defined(__GNUC__) && defined(HAVE_VISIBILITY)
+#pragma GCC visibility push(default)
+#endif
+
+#include <ptlib.h>
+#include <h323.h>
+#include <h323neg.h>
+#include <h323pdu.h>
+#include <h323caps.h>
+#include <ptclib/delaychan.h>
+
+#include <list>
+
+
+#if defined(__GNUC__) && defined(HAVE_VISIBILITY)
+#pragma GCC visibility pop
+#endif
+
+#undef strcasecmp
+#undef strncasecmp
+
+#define HAVE_APR
+#include <switch.h>
+#include <switch_version.h>
+#define MODNAME "mod_h323"
+
+
+typedef enum {
+ TFLAG_IO = (1 << 0),
+ TFLAG_INBOUND = (1 << 1),
+ TFLAG_OUTBOUND = (1 << 2),
+ TFLAG_READING = (1 << 3),
+ TFLAG_WRITING = (1 << 4),
+ TFLAG_BYE = (1 << 5),
+ TFLAG_VOICE = (1 << 6),
+ TFLAG_RTP_READY = (1 << 7),
+ TFLAG_CODEC_READY = (1 << 8),
+ TFLAG_TRANSPORT = (1 << 9),
+ TFLAG_ANSWER = (1 << 10),
+ TFLAG_VAD_IN = (1 << 11),
+ TFLAG_VAD_OUT = (1 << 12),
+ TFLAG_VAD = (1 << 13),
+ TFLAG_DO_CAND = (1 << 14),
+ TFLAG_DO_DESC = (1 << 15),
+ TFLAG_LANADDR = (1 << 16),
+ TFLAG_AUTO = (1 << 17),
+ TFLAG_DTMF = (1 << 18),
+ TFLAG_TIMER = (1 << 19),
+ TFLAG_TERM = (1 << 20),
+ TFLAG_TRANSPORT_ACCEPT = (1 << 21),
+ TFLAG_READY = (1 << 22),
+} TFLAGS;
+
+struct mod_h323_globals {
+ int trace_level;
+ char *codec_string;
+ char *context;
+ char *dialplan;
+};
+
+extern struct mod_h323_globals mod_h323_globals;
+
+class FSH323Connection;
+class FSH323_ExternalRTPChannel;
+
+typedef struct {
+ unsigned int flags;
+ 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_rtp_t *rtp_session;
+ switch_mutex_t *flag_mutex;
+ switch_mutex_t *h323_mutex;
+
+ FSH323Connection *me;
+} h323_private_t;
+
+#define DECLARE_CALLBACK0(name) \
+ static switch_status_t name(switch_core_session_t *session) { \
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(session); \
+ return tech_pvt && tech_pvt->me != NULL ? tech_pvt->me->name() : SWITCH_STATUS_FALSE; } \
+switch_status_t name()
+
+#define DECLARE_CALLBACK1(name, type1, name1) \
+ static switch_status_t name(switch_core_session_t *session, type1 name1) { \
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(session); \
+ return tech_pvt && tech_pvt->me != NULL ? tech_pvt->me->name(name1) : SWITCH_STATUS_FALSE; } \
+switch_status_t name(type1 name1)
+
+#define DECLARE_CALLBACK3(name, type1, name1, type2, name2, type3, name3) \
+ static switch_status_t name(switch_core_session_t *session, type1 name1, type2 name2, type3 name3) { \
+ h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(session); \
+ return tech_pvt && tech_pvt->me != NULL ? tech_pvt->me->name(name1, name2, name3) : SWITCH_STATUS_FALSE; } \
+switch_status_t name(type1 name1, type2 name2, type3 name3)
+
+class FSH323EndPoint;
+class FSProcess : public PLibraryProcess {
+ PCLASSINFO(FSProcess, PLibraryProcess);
+
+ public:
+ FSProcess();
+ ~FSProcess();
+
+ bool Initialise(switch_loadable_module_interface_t *iface);
+
+ FSH323EndPoint & GetH323EndPoint() const { return *m_h323endpoint; }
+
+ protected:
+ FSH323EndPoint * m_h323endpoint;
+};
+
+struct FSListener {
+ FSListener() {
+ }
+
+ PString name;
+ H323ListenerTCP *listenAddress;
+ PString localUserName;
+ PString gatekeeper;
+};
+class FSGkRegThread;
+class FSH323EndPoint:public H323EndPoint {
+
+ 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 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);
+ 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;
+
+};
+
+
+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)
+
+ public:
+ FSH323Connection(FSH323EndPoint& endpoint,
+ H323Transport* transport,
+ unsigned callReference,
+ switch_caller_profile_t *outbound_profile,
+ switch_core_session_t *fsSession,
+ switch_channel_t *fsChannel);
+
+ ~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 void OnReceivedReleaseComplete(const H323SignalPDU & pdu);
+ virtual bool OnReceivedProgress(const H323SignalPDU &);
+ virtual bool OnSendReleaseComplete(H323SignalPDU & pdu);
+ 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 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);
+ virtual bool OnReceivedCapabilitySet(const H323Capabilities & remoteCaps,
+ 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);
+ 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);
+
+ 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);
+
+ bool m_callOnPreAnswer;
+ bool m_startRTP;
+ bool m_rxChennel;
+ bool m_txChennel;
+ bool m_ChennelAnswer;
+ bool m_ChennelProgress;
+ protected:
+ FSH323EndPoint * m_endpoint;
+ PString m_remoteAddr;
+ int m_remotePort;
+ switch_core_session_t *m_fsSession;
+ 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();
+
+ 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;
+ switch_core_session_t *m_fsSession;
+ switch_channel_t *m_fsChannel;
+ switch_codec_t *m_switchCodec;
+ OpalMediaFormat *m_format;
+ switch_frame_t m_readFrame;
+ switch_timer_t *m_switchTimer;
+ PString m_RTPremoteIP;
+ WORD m_RTPremotePort;
+ 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)
+ return false;
+ 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;
+};
+
+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
+{
+ 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);
+ }
+
+ virtual H323Codec* CreateCodec(H323Codec::Direction direction) const{
+ return 0;
+ }
+
+ virtual unsigned GetSubType() const{
+ return H245_AudioCapability::e_gsmFullRate;
+ }
+
+ virtual PString GetFormatName() const{
+ return m_name;
+ }
+
+ 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){
+ PTRACE(2, "mod_h323\t==============>BaseGSM0610Cap::OnReceivedPDU");
+ if (pdu.GetTag() != H245_AudioCapability::e_gsmFullRate)
+ return false;
+ const H245_GSMAudioCapability & gsm = pdu;
+ packetSize = (gsm.m_audioUnitSize + 32) / 33;
+ m_comfortNoise = gsm.m_comfortNoise;
+ m_scrambled = gsm.m_scrambled;
+ return true;
+ }
+
+protected:
+ const char* m_name;
+ int m_comfortNoise;
+ int m_scrambled;
+ unsigned m_type;
+};
+
+
+#define DEFINE_H323_CAPAB(cls,base,param,name) \
+class cls : public base { \
+ public: \
+ cls() : base(name,param) { } \
+}; \
+H323_REGISTER_CAPABILITY(cls,name) \
+
+
+
+
+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;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_iax/mod_iax.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_iax/mod_iax.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_iax/mod_iax.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1032,7 +1032,6 @@
break;
case IAX_EVENT_RINGA:
if (channel) {
- switch_core_session_queue_indication(tech_pvt->session, SWITCH_MESSAGE_INDICATE_RINGING);
switch_channel_mark_ring_ready(channel);
}
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_NOTICE, "Ringing heard.\n");
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_loopback/mod_loopback.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_loopback/mod_loopback.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_loopback/mod_loopback.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -314,6 +314,7 @@
{
switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
+ const char *app, *arg;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -324,6 +325,21 @@
do_reset(tech_pvt);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel));
+
+
+ if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && (app = switch_channel_get_variable(channel, "loopback_app"))) {
+ switch_caller_extension_t *extension = NULL;
+ arg = switch_channel_get_variable(channel, "loopback_app_arg");
+ 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;
}
@@ -555,6 +571,7 @@
if (tech_pvt->write_frame) {
switch_frame_free(&tech_pvt->write_frame);
}
+
tech_pvt->write_frame = (switch_frame_t *) pop;
tech_pvt->write_frame->codec = &tech_pvt->read_codec;
*frame = tech_pvt->write_frame;
@@ -571,6 +588,7 @@
*frame = &tech_pvt->cng_frame;
tech_pvt->cng_frame.codec = &tech_pvt->read_codec;
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));
@@ -797,6 +815,23 @@
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
caller_profile->source = switch_core_strdup(caller_profile->pool, modname);
+ if (!strncasecmp(caller_profile->destination_number, "app=", 4)) {
+ char *dest = switch_core_session_strdup(*new_session, caller_profile->destination_number);
+ char *app = dest + 4;
+ char *arg = NULL;
+
+ if ((arg = strchr(app, ':'))) {
+ *arg++ = '\0';
+ }
+
+ switch_channel_set_variable(channel, "loopback_app", app);
+ if (arg) {
+ switch_channel_set_variable(channel, "loopback_app_arg", arg);
+ }
+
+ caller_profile->destination_number = switch_core_strdup(caller_profile->pool, app);
+ }
+
if ((context = strchr(caller_profile->destination_number, '/'))) {
*context++ = '\0';
@@ -804,20 +839,20 @@
*dialplan++ = '\0';
}
- if (!switch_strlen_zero(context)) {
+ if (!zstr(context)) {
caller_profile->context = switch_core_strdup(caller_profile->pool, context);
}
- if (!switch_strlen_zero(dialplan)) {
+ if (!zstr(dialplan)) {
caller_profile->dialplan = switch_core_strdup(caller_profile->pool, dialplan);
}
}
- if (switch_strlen_zero(caller_profile->context)) {
+ if (zstr(caller_profile->context)) {
caller_profile->context = switch_core_strdup(caller_profile->pool, "default");
}
- if (switch_strlen_zero(caller_profile->dialplan)) {
+ if (zstr(caller_profile->dialplan)) {
caller_profile->dialplan = switch_core_strdup(caller_profile->pool, "xml");
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_portaudio/mod_portaudio.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_portaudio/mod_portaudio.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_portaudio/mod_portaudio.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -248,7 +248,6 @@
switch_mutex_unlock(globals.pvt_lock);
switch_yield(1000000);
} else {
- switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
switch_channel_mark_ring_ready(channel);
}
@@ -750,7 +749,7 @@
if (outbound_profile) {
char name[128];
- const char *id = !switch_strlen_zero(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
+ const char *id = !zstr(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
switch_snprintf(name, sizeof(name), "portaudio/%s", id);
switch_channel_set_name(channel, name);
@@ -1052,7 +1051,7 @@
int match = 0;
pdi = Pa_GetDeviceInfo(i);
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
match = 1;
} else if (pdi && pdi->name && strstr(pdi->name, name)) {
match = 1;
@@ -1477,7 +1476,7 @@
char *dtmf_str = argv[0];
switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
- if (switch_strlen_zero(dtmf_str)) {
+ if (zstr(dtmf_str)) {
stream->write_function(stream, "No DTMF Supplied!\n");
} else {
switch_mutex_lock(globals.pvt_lock);
@@ -1504,7 +1503,7 @@
switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(callid)) {
+ if (zstr(callid)) {
if (globals.call_list) {
if (globals.call_list->next) {
tech_pvt = globals.call_list->next;
@@ -1549,7 +1548,7 @@
char *callid = argv[0];
switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(callid)) {
+ if (zstr(callid)) {
tech_pvt = globals.call_list;
} else {
tech_pvt = switch_core_hash_find(globals.call_hash, callid);
@@ -1574,7 +1573,7 @@
switch_mutex_lock(globals.pvt_lock);
- if (!switch_strlen_zero(callid)) {
+ if (!zstr(callid)) {
if ((tp = switch_core_hash_find(globals.call_hash, callid))) {
if (switch_test_flag(tp, TFLAG_ANSWER)) {
stream->write_function(stream, "CALL ALREADY ANSWERED\n");
@@ -1717,7 +1716,7 @@
switch_status_t status = SWITCH_STATUS_SUCCESS;
char *dest = NULL;
- if (switch_strlen_zero(argv[0])) {
+ if (zstr(argv[0])) {
stream->write_function(stream, "FAIL:Usage: call <dest>\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -1746,23 +1745,23 @@
return SWITCH_STATUS_MEMERR;
}
- if (!switch_strlen_zero(argv[1])) {
+ if (!zstr(argv[1])) {
dialplan = argv[1];
}
- if (!switch_strlen_zero(argv[2])) {
+ if (!zstr(argv[2])) {
cid_num = argv[2];
}
- if (!switch_strlen_zero(argv[3])) {
+ if (!zstr(argv[3])) {
cid_name = argv[3];
}
- if (!switch_strlen_zero(argv[4])) {
+ if (!zstr(argv[4])) {
tech_pvt->sample_rate = atoi(argv[4]);
}
- if (!switch_strlen_zero(argv[5])) {
+ if (!zstr(argv[5])) {
tech_pvt->codec_ms = atoi(argv[5]);
}
@@ -1863,13 +1862,13 @@
}
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto done;
}
} else {
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_skypiax/configs/default.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_skypiax/configs/default.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_skypiax/configs/default.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -261,7 +261,7 @@
<!-- dial via skypiax -->
<extension name="skypiax">
<condition field="destination_number" expression="^2909$">
- <action application="bridge" data="skypiax/skypiax1/echo123"/>
+ <action application="bridge" data="skypiax/interface1/echo123"/>
</condition>
</extension>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_skypiax/mod_skypiax.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_skypiax/mod_skypiax.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_skypiax/mod_skypiax.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -866,7 +866,7 @@
switch_core_session_add_stream(*new_session, NULL);
- if (!switch_strlen_zero(outbound_profile->destination_number)) {
+ if (!zstr(outbound_profile->destination_number)) {
int i;
char *slash;
@@ -1767,7 +1767,7 @@
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
- if (!switch_strlen_zero(tech_pvt->session_uuid_str)) {
+ if (!zstr(tech_pvt->session_uuid_str)) {
session = switch_core_session_locate(tech_pvt->session_uuid_str);
} else {
ERRORA("No session???\n", SKYPIAX_P_LOG);
@@ -1797,7 +1797,7 @@
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
- if (!switch_strlen_zero(tech_pvt->session_uuid_str)) {
+ if (!zstr(tech_pvt->session_uuid_str)) {
session = switch_core_session_locate(tech_pvt->session_uuid_str);
} else {
ERRORA("No session???\n\n\n", SKYPIAX_P_LOG);
@@ -1831,7 +1831,7 @@
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
- if (!switch_strlen_zero(tech_pvt->session_uuid_str)) {
+ if (!zstr(tech_pvt->session_uuid_str)) {
session = switch_core_session_locate(tech_pvt->session_uuid_str);
} else {
ERRORA("No session???\n", SKYPIAX_P_LOG);
@@ -1917,7 +1917,7 @@
else
stream->write_function(stream, "sk console is NOT yet assigned\n");
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -2031,7 +2031,7 @@
int argc = 0;
private_t *tech_pvt = NULL;
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -2280,7 +2280,7 @@
DEBUGA_SKYPE("received CHATMESSAGE on interface %s\n", SKYPIAX_P_LOG, tech_pvt->name);
- if (!switch_strlen_zero(tech_pvt->session_uuid_str)) {
+ if (!zstr(tech_pvt->session_uuid_str)) {
session = switch_core_session_locate(tech_pvt->session_uuid_str);
}
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
@@ -2348,7 +2348,7 @@
int found = 0;
//char skype_msg[1024];
- if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/mod_sofia.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/mod_sofia.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/mod_sofia.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -88,7 +88,7 @@
if (sofia_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
const char *var;
- if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && !switch_strlen_zero(var)) {
+ if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && !zstr(var)) {
if (switch_true(var) || !strcasecmp(var, SWITCH_RTP_CRYPTO_KEY_32)) {
sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
sofia_glue_build_crypto(tech_pvt, 1, AES_CM_128_HMAC_SHA1_32, SWITCH_RTP_CRYPTO_SEND);
@@ -175,18 +175,41 @@
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;
+ const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
char *pai = NULL;
- if ((callee_name = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_name"))) {
- if (!(callee_number = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_number"))) {
+ if (!(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, "sip_callee_id_number")))) {
+ if (zstr((callee_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number")))) {
callee_number = tech_pvt->caller_profile->destination_number;
}
- pai = switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>", callee_name, callee_number);
}
+
+ if (zstr(callee_name) && !zstr(callee_number)) {
+ callee_name = callee_number;
+ }
+
+ 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);
+ }
+
+
+ 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, "P-Asserted-Identity: \"%s\" <%s>\nX-FS-Display-Name: %s\nX-FS-Display-Number: %s\n",
+ callee_name, callee_number, callee_name, callee_number);
+ } else {
+ pai = switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>\n",
+ callee_name, callee_number, callee_name, callee_number);
+ }
+ }
return pai;
}
@@ -300,7 +323,7 @@
ps_cause = switch_channel_get_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE);
}
- if (!switch_strlen_zero(ps_cause) && (!strncasecmp(ps_cause, "sip:", 4) || !strncasecmp(ps_cause, "sips:", 5))) {
+ if (!zstr(ps_cause) && (!strncasecmp(ps_cause, "sip:", 4) || !strncasecmp(ps_cause, "sips:", 5))) {
int new_cause = atoi(sofia_glue_strip_proto(ps_cause));
if (new_cause) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Overriding SIP cause %d with %d from the other leg\n",
@@ -377,8 +400,8 @@
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
nua_bye(tech_pvt->nh,
SIPTAG_REASON_STR(reason),
- TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
- TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+ 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());
}
} else {
@@ -390,7 +413,7 @@
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
nua_cancel(tech_pvt->nh,
SIPTAG_REASON_STR(reason),
- TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+ TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
TAG_END());
}
} else {
@@ -401,7 +424,7 @@
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause),
SIPTAG_REASON_STR(reason),
- TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+ TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
TAG_END());
}
}
@@ -468,6 +491,13 @@
} else {
/* This if statement check and handles the 3pcc proxy mode */
if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
+
+ tech_pvt->num_codecs = 0;
+ sofia_glue_tech_prepare_codecs(tech_pvt);
+ 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);
@@ -476,7 +506,9 @@
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(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+ 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_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Sent a 200 OK, waiting for ACK\n");
@@ -495,6 +527,7 @@
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;
}
if ((is_proxy && !b_sdp) || sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
@@ -564,7 +597,9 @@
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(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+ 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);
@@ -1045,6 +1080,31 @@
/* ones that do not need to lock sofia mutex */
switch (msg->message_id) {
+ 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])) {
+ int32_t flags = 0;
+ if (!strcasecmp(msg->string_array_arg[0], "read")) {
+ flags |= SWITCH_RTP_FLAG_DEBUG_RTP_READ;
+ } else if (!strcasecmp(msg->string_array_arg[0], "write")) {
+ flags |= SWITCH_RTP_FLAG_DEBUG_RTP_WRITE;
+ } else if (!strcasecmp(msg->string_array_arg[0], "both")) {
+ flags |= SWITCH_RTP_FLAG_DEBUG_RTP_READ | SWITCH_RTP_FLAG_DEBUG_RTP_WRITE;
+ }
+
+ if (flags) {
+ if (switch_true(msg->string_array_arg[1])) {
+ switch_rtp_set_flag(tech_pvt->rtp_session, flags);
+ } else {
+ switch_rtp_clear_flag(tech_pvt->rtp_session, flags);
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Options\n");
+ }
+ }
+ }
+ status = SWITCH_STATUS_FALSE;
+ goto end;
case SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY:
if (tech_pvt->rtp_session && switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Pass 2833 mode may not work on a transcoded call.\n");
@@ -1224,7 +1284,7 @@
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(channel, CF_ANSWERED) || switch_channel_test_flag(channel, CF_EARLY_MEDIA))) {
if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
@@ -1255,22 +1315,100 @@
}
break;
+ case SWITCH_MESSAGE_INDICATE_WARNING:
+ {
+ 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);
+ }
+
+ }
+ }
+ }
+ break;
case SWITCH_MESSAGE_INDICATE_DISPLAY:
{
- if (!switch_strlen_zero(msg->string_arg)) {
+ const char *name = msg->string_array_arg[0], *number = msg->string_array_arg[1];
+ char *arg = NULL;
+ char *argv[2] = { 0 };
+ int argc;
+
+ if (zstr(name) && !zstr(msg->string_arg)) {
+ arg = strdup(msg->string_arg);
+ switch_assert(arg);
+
+ argc = switch_separate_string(arg, '|', argv, (sizeof(argv) / sizeof(argv[0])));
+ name = argv[0];
+ number = argv[1];
+
+ }
+
+ if (!zstr(name)) {
char message[256] = "";
const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
+ switch_event_t *event;
- 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"), 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(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
- TAG_END());
+ if (zstr(number)) {
+ number = tech_pvt->caller_profile->destination_number;
}
+
+ 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());
+ } 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());
+ } 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());
+ }
+
+ 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");
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Name", name);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Number", number);
+ if (uuid) {
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", uuid);
+ }
+ switch_channel_event_set_data(channel, event);
+ switch_event_fire(&event);
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Not sending same id again \"%s\" <%s>\n", name, number);
+ }
+ }
}
+
+ switch_safe_free(arg);
}
break;
@@ -1278,17 +1416,20 @@
{
sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
sofia_glue_do_invite(session);
- if (!switch_strlen_zero(msg->string_arg)) {
+ if (!zstr(msg->string_arg)) {
char message[256] = "";
const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
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"), SIPTAG_PAYLOAD_STR(message), TAG_END());
+ 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());
} 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(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
+ 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());
}
}
@@ -1302,10 +1443,17 @@
}
break;
case SWITCH_MESSAGE_INDICATE_REDIRECT:
- if (!switch_strlen_zero(msg->string_arg)) {
+ if (!zstr(msg->string_arg)) {
if (!switch_channel_test_flag(channel, CF_ANSWERED) && !sofia_test_flag(tech_pvt, TFLAG_BYE)) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirecting to %s\n", msg->string_arg);
- nua_respond(tech_pvt->nh, SIP_302_MOVED_TEMPORARILY, SIPTAG_CONTACT_STR(msg->string_arg), TAG_END());
+ char *dest = (char *) msg->string_arg;
+
+ 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_END());
sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Too late for redirecting to %s, already answered\n", msg->string_arg);
@@ -1343,7 +1491,7 @@
if (code) {
reason = msg->string_arg;
} else {
- if (!switch_strlen_zero(msg->string_arg)) {
+ if (!zstr(msg->string_arg)) {
if ((code = atoi(msg->string_arg))) {
if ((reason = strchr(msg->string_arg, ' '))) {
reason++;
@@ -1362,9 +1510,9 @@
}
}
- if (switch_strlen_zero(reason) && code != 407 && code != 302) {
+ if (zstr(reason) && code != 407 && code != 302) {
reason = sip_status_phrase(code);
- if (switch_strlen_zero(reason)) {
+ if (zstr(reason)) {
reason = "Because";
}
}
@@ -1375,7 +1523,7 @@
const char *to_uri = switch_channel_get_variable(channel, "sip_to_uri");
const char *to_host = reason;
- if (switch_strlen_zero(to_host)) {
+ if (zstr(to_host)) {
to_host = switch_channel_get_variable(channel, "sip_to_host");
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Challenging call %s\n", to_uri);
@@ -1399,12 +1547,12 @@
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Overlap Dial with %d %s\n", code, reason);
nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), TAG_IF(to_uri, SIPTAG_CONTACT_STR(to_uri)),
SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL),
- TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
- TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END());
+ 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);
}
- } else if (code == 302 && !switch_strlen_zero(msg->string_arg)) {
+ } else if (code == 302 && !zstr(msg->string_arg)) {
char *p;
if ((p = strchr(msg->string_arg, ' '))) {
@@ -1418,7 +1566,7 @@
} else {
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason);
- if (!switch_strlen_zero(((char *) msg->pointer_arg))) {
+ 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)) {
@@ -1429,11 +1577,11 @@
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(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+ 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(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+ TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
TAG_END());
}
}
@@ -1442,15 +1590,26 @@
}
break;
case SWITCH_MESSAGE_INDICATE_RINGING:
+
+ 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,
+ "Pretending to send ringing. Not available for 3pcc calls\n");
+ goto end_lock;
+ }
+
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_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
+ char *extra_header = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
nua_respond(tech_pvt->nh, SIP_180_RINGING,
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SIPTAG_HEADER_STR(generate_pai_str(session)),
- TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+ 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_headers);
+ switch_safe_free(extra_header);
switch_channel_mark_ring_ready(channel);
}
break;
@@ -1462,6 +1621,15 @@
char *sticky = NULL;
const char *val = NULL;
+ 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,
+ "Pretending to send early media. Not available for 3pcc calls\n");
+ goto end_lock;
+ }
+
if (!sofia_test_flag(tech_pvt, TFLAG_ANS) && !sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
@@ -1490,7 +1658,9 @@
tech_pvt->num_codecs = 0;
sofia_glue_tech_prepare_codecs(tech_pvt);
- if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
+ 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_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;
@@ -1522,7 +1692,7 @@
}
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
- char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
+ 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),
@@ -1533,9 +1703,11 @@
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(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+ 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_headers);
+ switch_safe_free(extra_header);
}
}
}
@@ -1546,6 +1718,10 @@
end_lock:
+ if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
+ sofia_send_callee_id(session, NULL, NULL);
+ }
+
switch_mutex_unlock(tech_pvt->sofia_mutex);
end:
@@ -1634,10 +1810,12 @@
"IP: \t%s\n"
"Port: \t%s\n"
"Auth-User: \t%s\n"
- "Auth-Realm: \t%s\n\n",
+ "Auth-Realm: \t%s\n"
+ "MWI-Account:\t%s@%s\n\n",
switch_str_nil(argv[0]), switch_str_nil(argv[1]), switch_str_nil(argv[2]), switch_str_nil(argv[3]),
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[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]));
return 0;
}
@@ -1669,11 +1847,13 @@
" <network-port>%s</network-port>\n"
" <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),
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[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]));
return 0;
}
@@ -1705,7 +1885,7 @@
stream->write_function(stream, "Scheme \t%s\n", switch_str_nil(gp->register_scheme));
stream->write_function(stream, "Realm \t%s\n", switch_str_nil(gp->register_realm));
stream->write_function(stream, "Username\t%s\n", switch_str_nil(gp->register_username));
- stream->write_function(stream, "Password\t%s\n", switch_strlen_zero(gp->register_password) ? "no" : "yes");
+ stream->write_function(stream, "Password\t%s\n", zstr(gp->register_password) ? "no" : "yes");
stream->write_function(stream, "From \t%s\n", switch_str_nil(gp->register_from));
stream->write_function(stream, "Contact \t%s\n", switch_str_nil(gp->register_contact));
stream->write_function(stream, "Exten \t%s\n", switch_str_nil(gp->extension));
@@ -1742,7 +1922,7 @@
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",
- switch_strlen_zero(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
+ 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);
@@ -1758,8 +1938,8 @@
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", switch_strlen_zero(profile->hold_music) ? "N/A" : profile->hold_music);
- stream->write_function(stream, "OUTBOUND-PROXY \t%s\n", switch_strlen_zero(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
+ stream->write_function(stream, "HOLD-MUSIC \t%s\n", zstr(profile->hold_music) ? "N/A" : profile->hold_music);
+ stream->write_function(stream, "OUTBOUND-PROXY \t%s\n", zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
stream->write_function(stream, "CODECS \t%s\n", switch_str_nil(profile->codec_string));
stream->write_function(stream, "TEL-EVENT \t%d\n", profile->te);
if (profile->dtmf_type == DTMF_2833) {
@@ -1791,14 +1971,14 @@
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"
+ "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"
+ "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]);
}
@@ -1816,9 +1996,9 @@
host = dup;
}
- if (switch_strlen_zero(user) ) {
+ if (zstr(user) ) {
sqlextra = switch_mprintf("(sip_host='%q')", host);
- } else if (switch_strlen_zero(host)) {
+ } else if (zstr(host)) {
sqlextra = switch_mprintf("(sip_user='%q')", user);
} else {
sqlextra = switch_mprintf("(sip_user='%q' and sip_host='%q')", user, host);
@@ -1826,7 +2006,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"
+ "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);
@@ -1836,7 +2016,7 @@
if (!sql) {
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"
+ "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
" from sip_registrations where profile_name='%q'",
profile->name);
}
@@ -1929,7 +2109,7 @@
stream->write_function(stream, " <scheme>%s</scheme>\n", switch_str_nil(gp->register_scheme));
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", switch_strlen_zero(gp->register_password) ? "no" : "yes");
+ 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));
@@ -1969,7 +2149,7 @@
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",
- switch_strlen_zero(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
+ 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);
stream->write_function(stream, " <sip-ip>%s</sip-ip>\n", switch_str_nil(profile->sipip));
@@ -1978,8 +2158,8 @@
stream->write_function(stream, " <bind-url>%s</bind-url>\n", switch_str_nil(profile->bindurl));
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", switch_strlen_zero(profile->hold_music) ? "N/A" : profile->hold_music);
- stream->write_function(stream, " <outbound-proxy>%s</outbound-proxy>\n", switch_strlen_zero(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
+ stream->write_function(stream, " <hold-music>%s</hold-music>\n", zstr(profile->hold_music) ? "N/A" : profile->hold_music);
+ stream->write_function(stream, " <outbound-proxy>%s</outbound-proxy>\n", zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
stream->write_function(stream, " <codecs>%s</codecs>\n", switch_str_nil(profile->codec_string));
stream->write_function(stream, " <tel-event>%d</tel-event>\n", profile->te);
stream->write_function(stream, " <dtmf-mode>rfc2833</dtmf-mode>\n");
@@ -2011,7 +2191,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"
+ "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]);
}
@@ -2019,7 +2199,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"
+ "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]);
}
@@ -2037,9 +2217,9 @@
host = dup;
}
- if (switch_strlen_zero(user)) {
+ if (zstr(user)) {
sqlextra = switch_mprintf("(sip_host='%q')", host);
- } else if (switch_strlen_zero(host)) {
+ } else if (zstr(host)) {
sqlextra = switch_mprintf("(sip_user='%q')", user);
} else {
sqlextra = switch_mprintf("(sip_user='%q' and sip_host='%q')", user, host);
@@ -2047,7 +2227,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"
+ "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);
@@ -2057,7 +2237,7 @@
if (!sql) {
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"
+ "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
" from sip_registrations where profile_name='%q'",
profile->name);
}
@@ -2154,7 +2334,7 @@
return SWITCH_STATUS_SUCCESS;
}
- if (switch_strlen_zero(profile_name) || !(profile = sofia_glue_find_profile(profile_name))) {
+ 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;
}
@@ -2254,7 +2434,7 @@
char *gname = argv[2];
sofia_gateway_t *gateway_ptr;
- if (switch_strlen_zero(gname)) {
+ if (zstr(gname)) {
stream->write_function(stream, "No gateway name provided!\n");
goto done;
}
@@ -2281,7 +2461,7 @@
char *gname = argv[2];
sofia_gateway_t *gateway_ptr;
- if (switch_strlen_zero(gname)) {
+ if (zstr(gname)) {
stream->write_function(stream, "No gateway name provided!\n");
goto done;
}
@@ -2357,7 +2537,7 @@
struct cb_helper *cb = (struct cb_helper *) pArg;
char *contact;
- if (!switch_strlen_zero(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);
}
@@ -2455,11 +2635,11 @@
sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, contact_callback, &cb);
switch_safe_free(sql);
reply = (char *) mystream.data;
- if (!switch_strlen_zero(reply) && end_of(reply) == ',') {
+ if (!zstr(reply) && end_of(reply) == ',') {
end_of(reply) = '\0';
}
- if (switch_strlen_zero(reply)) {
+ if (zstr(reply)) {
reply = "error/user_not_registered";
}
@@ -2493,7 +2673,7 @@
char *gwname, *param, *varname;
const char *val = NULL;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-ERR Parameter missing\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -2509,7 +2689,7 @@
param = argv[1];
varname = argv[2];
- if (switch_strlen_zero(gwname) || switch_strlen_zero(param) || switch_strlen_zero(varname)) {
+ if (zstr(gwname) || zstr(param) || zstr(varname)) {
goto end;
}
@@ -2557,7 +2737,7 @@
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
@@ -2658,16 +2838,21 @@
{
switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
switch_core_session_t *nsession = NULL;
- char *data, *profile_name, *dest;
+ 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;
switch_channel_t *nchannel;
- char *host = NULL, *dest_to = NULL;
+ char *host = NULL, *dest_to = NULL, *p;
const char *hval = NULL;
*new_session = NULL;
+ if (!outbound_profile || zstr(outbound_profile->destination_number)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid Destination\n");
+ goto error;
+ }
+
if (!(nsession = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n");
goto error;
@@ -2728,6 +2913,7 @@
tech_pvt->transport = gateway_ptr->register_transport;
+
/*
* Handle params, strip them off the destination and add them to the
* invite contact.
@@ -2771,6 +2957,16 @@
tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s", dest);
}
+ if ((host = switch_core_session_strdup(nsession, tech_pvt->dest))) {
+ char *p = strchr(host, '@');
+ if (p) {
+ host = p+1;
+ } else {
+ host = NULL;
+ dest_to = NULL;
+ }
+ }
+
if (params) {
tech_pvt->invite_contact = switch_core_session_sprintf(nsession, "%s;%s", gateway_ptr->register_contact, params);
} else {
@@ -2779,11 +2975,11 @@
gateway_ptr->ob_calls++;
- if (!switch_strlen_zero(gateway_ptr->from_domain) && !switch_channel_get_variable(nchannel, "sip_invite_domain")) {
+ 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);
}
- if (!switch_strlen_zero(gateway_ptr->outbound_sticky_proxy) && !switch_channel_get_variable(nchannel, "sip_route_uri")) {
+ 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);
}
@@ -2872,8 +3068,16 @@
}
switch_channel_set_variable(nchannel, "sip_destination_url", tech_pvt->dest);
+ dest_num = switch_core_session_strdup(nsession, dest);
+ if ((p = strchr(dest_num, ':'))) {
+ dest_num = p + 1;
+ if ((p = strchr(dest_num, '@'))) {
+ *p = '\0';
+ }
+ }
+
caller_profile = switch_caller_profile_clone(nsession, outbound_profile);
- caller_profile->destination_number = switch_core_strdup(caller_profile->pool, dest);
+ 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);
@@ -2890,6 +3094,14 @@
switch_channel_set_variable(nchannel, "sip_invite_params", "intercom=true");
}
+ if ((hval = switch_event_get_header(var_event, "sip_callee_id_name"))) {
+ caller_profile->callee_id_name = switch_core_strdup(caller_profile->pool, hval);
+ }
+
+ if ((hval = switch_event_get_header(var_event, "sip_callee_id_number"))) {
+ caller_profile->callee_id_number = switch_core_strdup(caller_profile->pool, hval);
+ }
+
if (session) {
switch_channel_t *o_channel = switch_core_session_get_channel(session);
const char *vval = NULL;
@@ -2906,7 +3118,7 @@
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
@@ -2998,7 +3210,7 @@
NUTAG_NEWSUB(1),
SIPTAG_EVENT_STR(es),
SIPTAG_CONTENT_TYPE_STR(ct),
- TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
+ TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
TAG_END());
@@ -3076,7 +3288,7 @@
NUTAG_WITH_THIS(profile->nua),
SIPTAG_EVENT_STR(es),
TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)),
- TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
+ TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
TAG_END());
sofia_glue_release_profile(profile);
@@ -3095,7 +3307,7 @@
NUTAG_NEWSUB(1),
SIPTAG_EVENT_STR(es),
SIPTAG_CONTENT_TYPE_STR(ct),
- TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
+ TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
TAG_END());
}
switch_core_session_rwunlock(session);
@@ -3108,10 +3320,18 @@
"from sip_registrations where call_id='%q'", ct, es, switch_str_nil(body), call_id
);
} 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)
- );
+ 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)
+ );
+ } 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)
+ );
+
+ }
}
@@ -3171,7 +3391,7 @@
nua_message(nh,
NUTAG_NEWSUB(1),
SIPTAG_CONTENT_TYPE_STR(ct),
- TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
+ TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
TAG_END());
@@ -3267,7 +3487,7 @@
TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)),
TAG_IF(alert_info, SIPTAG_ALERT_INFO_STR(alert_info)),
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
- TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
+ TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
TAG_END());
if (call_id && nh) {
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/mod_sofia.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/mod_sofia.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/mod_sofia.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -37,7 +37,7 @@
/*Defines etc..*/
/*************************************************************************************************************************************************************/
#define MANUAL_BYE
-
+#define DEFAULT_NONCE_TTL 60
#define IREG_SECONDS 30
#define GATEWAY_SECONDS 1
#define SOFIA_QUEUE_SIZE 50000
@@ -79,6 +79,7 @@
#define MY_EVENT_EXPIRE "sofia::expire"
#define MY_EVENT_GATEWAY_STATE "sofia::gateway_state"
#define MY_EVENT_NOTIFY_REFER "sofia::notify_refer"
+#define MY_EVENT_REINVITE "sofia::reinvite"
#define MULTICAST_EVENT "multicast::event"
#define SOFIA_REPLACES_HEADER "_sofia_replaces_"
@@ -96,6 +97,7 @@
#define SOFIA_SECURE_MEDIA_CONFIRMED_VARIABLE "sip_secure_media_confirmed"
#define SOFIA_HAS_CRYPTO_VARIABLE "sip_has_crypto"
#define SOFIA_CRYPTO_MANDATORY_VARIABLE "sip_crypto_mandatory"
+#define FREESWITCH_SUPPORT "update_display"
#include <sofia-sip/nua.h>
#include <sofia-sip/sip_status.h>
@@ -195,6 +197,8 @@
PFLAG_MANUAL_REDIRECT,
PFLAG_AUTO_NAT,
PFLAG_SIPCOMPACT,
+ PFLAG_SQL_IN_TRANS,
+ PFLAG_PASS_CALLEE_ID,
/* No new flags below this line */
PFLAG_MAX
} PFLAGS;
@@ -245,7 +249,7 @@
TFLAG_HOLD_LOCK,
TFLAG_3PCC_HAS_ACK,
TFLAG_PASS_RFC2833,
-
+ TFLAG_UPDATING_DISPLAY,
/* No new flags below this line */
TFLAG_MAX
} TFLAGS;
@@ -438,6 +442,7 @@
char *reg_db_domain;
char *user_agent;
char *record_template;
+ char *record_path;
char *presence_hosts;
char *challenge_realm;
sofia_cid_type_t cid_type;
@@ -579,6 +584,10 @@
char *extrtpip;
char *stun_ip;
char *route_uri;
+ char *x_freeswitch_support_remote;
+ char *x_freeswitch_support_local;
+ char *last_sent_callee_id_name;
+ char *last_sent_callee_id_number;
switch_port_t stun_port;
uint32_t stun_flags;
unsigned long rm_rate;
@@ -810,7 +819,7 @@
#define check_decode(_var, _session) do { \
assert(_session); \
- if (!switch_strlen_zero(_var)) { \
+ if (!zstr(_var)) { \
int d = 0; \
char *p; \
if (strchr(_var, '%')) { \
@@ -910,3 +919,6 @@
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);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/sofia.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/sofia.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/sofia.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -52,8 +52,8 @@
static void set_variable_sip_param(switch_channel_t *channel, char *header_type, sip_param_t const *params);
-static void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg);
+
static void sofia_handle_sip_i_state(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,
@@ -327,7 +327,7 @@
switch_channel_hangup(channel, cause);
nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua),
- TAG_IF(!switch_strlen_zero(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);
@@ -338,9 +338,9 @@
#endif
- if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)) {
+ if (sip->sip_user_agent && !zstr(sip->sip_user_agent->g_string)) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
- } else if (sip->sip_server && !switch_strlen_zero(sip->sip_server->g_string)) {
+ } else if (sip->sip_server && !zstr(sip->sip_server->g_string)) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_server->g_string);
}
@@ -376,6 +376,133 @@
}
+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;
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(channel);
+
+
+ if (zstr(name)) {
+ name = caller_profile->callee_id_name;
+ }
+
+ if (zstr(number)) {
+ number = caller_profile->callee_id_number;
+ }
+
+ if (zstr(name)) {
+ name = number;
+ }
+
+ if (zstr(number)) {
+ number = caller_profile->destination_number;
+ }
+
+ if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (session_b = switch_core_session_locate(uuid))) {
+ switch_core_session_message_t *msg;
+ //switch_channel_t *channel_b = switch_core_session_get_channel(session_b);
+
+ //switch_channel_set_profile_var(channel_b, "callee_id_name", name);
+ //switch_channel_set_profile_var(channel_b, "callee_id_number", number);
+
+ msg = switch_core_session_alloc(session_b, sizeof(*msg));
+ MESSAGE_STAMP_FFL(msg);
+ msg->message_id = SWITCH_MESSAGE_INDICATE_DISPLAY;
+ msg->string_array_arg[0] = switch_core_session_strdup(session_b, name);
+ msg->string_array_arg[1] = switch_core_session_strdup(session_b, number);
+ msg->from = __FILE__;
+ switch_core_session_queue_message(session_b, msg);
+ switch_core_session_rwunlock(session_b);
+ }
+}
+
+void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *profile, sip_t const *sip, switch_bool_t send)
+{
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ sip_p_asserted_identity_t *passerted = NULL;
+ char *name = NULL;
+ const char *number = "unknown", *tmp;
+ switch_caller_profile_t *caller_profile;
+ char *dup = NULL;
+ switch_event_t *event;
+ const char *val;
+ int fs = 0;
+
+ if (switch_true(switch_channel_get_variable(channel, SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE))) {
+ return;
+ }
+
+ if (sip->sip_to) {
+ number = sip->sip_to->a_url->url_user;
+ }
+
+ if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Display-Number"))) {
+ number = val;
+ fs++;
+ }
+
+ if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Display-Name"))) {
+ name = (char *)val;
+ fs++;
+ }
+
+ if (!fs) {
+ if ((passerted = sip_p_asserted_identity(sip))) {
+ if (passerted->paid_url && passerted->paid_url->url_user) {
+ number = passerted->paid_url->url_user;
+ }
+ if (!zstr(passerted->paid_display)) {
+ dup = strdup(passerted->paid_display);
+ if (*dup == '"') {
+ name = dup + 1;
+ } else {
+ name = dup;
+ }
+ if (end_of(name) == '"') {
+ end_of(name) = '\0';
+ }
+ }
+ }
+ }
+
+ if ((tmp = switch_channel_get_variable(channel, "sip_callee_id_name"))) {
+ name = (char *)tmp;
+ }
+
+ if ((tmp = switch_channel_get_variable(channel, "sip_callee_id_number"))) {
+ number = tmp;
+ }
+
+ if (!name) name = (char *) 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", "RECV");
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Name", name);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Number", number);
+ if (uuid) {
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", uuid);
+ }
+ 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_core_strdup(caller_profile->pool, name);
+ caller_profile->callee_id_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);
+
+ if (send) {
+ sofia_send_callee_id(session, NULL, NULL);
+ }
+
+ switch_safe_free(dup);
+}
+
+
void sofia_event_callback(nua_event_t event,
int status,
char const *phrase,
@@ -403,7 +530,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile %s is locked\n", gateway->profile->name);
return;
}
- } else if (!switch_strlen_zero(sofia_private->uuid)) {
+ } else if (!zstr(sofia_private->uuid)) {
if ((session = switch_core_session_locate(sofia_private->uuid))) {
tech_pvt = switch_core_session_get_private(session);
channel = switch_core_session_get_channel(session);
@@ -417,7 +544,7 @@
if (status >= 180 && !*sofia_private->auth_gateway_name) {
const char *gwname = switch_channel_get_variable(channel, "sip_use_gateway");
- if (!switch_strlen_zero(gwname)) {
+ if (!zstr(gwname)) {
switch_set_string(sofia_private->auth_gateway_name, gwname);
}
}
@@ -487,12 +614,15 @@
case nua_r_cancel:
case nua_i_error:
case nua_i_active:
- case nua_i_ack:
case nua_i_terminated:
case nua_r_set_params:
case nua_i_prack:
case nua_r_prack:
break;
+ case nua_i_ack:
+ case nua_r_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);
break;
@@ -540,7 +670,12 @@
case nua_i_info:
sofia_handle_sip_i_info(nua, profile, nh, session, sip, tags);
break;
+ case nua_i_update:
+ break;
case nua_r_update:
+ if (session && tech_pvt && locked) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY);
+ }
break;
case nua_r_refer:
break;
@@ -650,9 +785,26 @@
char *fixed_contact_str = NULL;
sofia_profile_t *profile = NULL;
-
char guess_ip4[256];
+ char *mwi_account = NULL;
+ char *dup_mwi_account = NULL;
+ char *mwi_user = NULL;
+ char *mwi_host = NULL;
+
+ if ((mwi_account = switch_event_get_header(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);
+ }
+
+ if (!mwi_user) {
+ mwi_user = (char *) from_user;
+ }
+ if (!mwi_host) {
+ mwi_host = (char *) from_host;
+ }
+
if (exp_str) {
expires += atol(exp_str);
}
@@ -663,7 +815,7 @@
if (!profile_name || !(profile = sofia_glue_find_profile(profile_name))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Profile\n");
- return;
+ goto end;
}
if (sofia_test_pflag(profile, PFLAG_MULTIREG)) {
sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id);
@@ -699,10 +851,10 @@
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) "
- "values ('%q','%q','%q','%q','%q','Registered','%q',%ld, '%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) "
+ "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);
+ profile_name, mod_sofia_globals.hostname, network_ip, network_port, username, realm, mwi_user, mwi_host);
if (sql) {
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
@@ -713,11 +865,13 @@
if (profile) {
sofia_glue_release_profile(profile);
}
-
+end:
switch_safe_free(fixed_contact_str);
+ switch_safe_free(dup_mwi_account);
}
}
+#define SQLLEN 1024 * 64
void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread, void *obj)
{
sofia_profile_t *profile = (sofia_profile_t *) obj;
@@ -726,7 +880,14 @@
int loops = 0;
uint32_t qsize;
void *pop;
-
+ int loop_count = 0;
+ switch_size_t sql_len = SQLLEN;
+ char *tmp, *sqlbuf = NULL;
+
+ if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) {
+ sqlbuf = (char *) malloc(sql_len);
+ }
+
ireg_loops = IREG_SECONDS;
gateway_loops = GATEWAY_SECONDS;
@@ -737,15 +898,57 @@
qsize = switch_queue_size(profile->sql_queue);
while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || qsize) {
- if (qsize) {
- switch_mutex_lock(profile->ireg_mutex);
- while (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
- sofia_glue_actually_execute_sql(profile, SWITCH_TRUE, (char *) pop, NULL);
- free(pop);
+ if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) {
+ if (qsize > 0 && (qsize >= 500 || ++loop_count >= 500)) {
+ switch_size_t newlen;
+ uint32_t itterations = 0;
+ switch_size_t len = 0;
+
+ switch_mutex_lock(profile->ireg_mutex);
+
+ sprintf(sqlbuf + len, "begin;\n");
+ len += 7;
+
+ 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) {
+ sql_len = len + 10 + SQLLEN;
+ if (!(tmp = realloc(sqlbuf, sql_len))) {
+ abort();
+ break;
+ }
+ sqlbuf = tmp;
+ }
+ sprintf(sqlbuf + len, "%s;\n", sql);
+ len += newlen;
+ }
+
+ free(pop);
+ }
+
+ sprintf(sqlbuf + len, "commit;\n");
+
+ //printf("TRANS:\n%s\n", sqlbuf);
+ sofia_glue_actually_execute_sql(profile, SWITCH_TRUE, sqlbuf, NULL);
+ switch_mutex_unlock(profile->ireg_mutex);
+ loop_count = 0;
}
- switch_mutex_unlock(profile->ireg_mutex);
+ } else {
+ if (qsize) {
+ switch_mutex_lock(profile->ireg_mutex);
+ while (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+ sofia_glue_actually_execute_sql(profile, SWITCH_TRUE, (char *) pop, NULL);
+ free(pop);
+ }
+ switch_mutex_unlock(profile->ireg_mutex);
+ }
}
-
+
if (++loops >= 100) {
if (++ireg_loops >= IREG_SECONDS) {
sofia_reg_check_expire(profile, switch_epoch_time_now(NULL), 0);
@@ -772,6 +975,7 @@
switch_mutex_unlock(profile->ireg_mutex);
sofia_clear_pflag_locked(profile, PFLAG_WORKER_RUNNING);
+ switch_safe_free(sqlbuf);
return NULL;
}
@@ -884,10 +1088,12 @@
NUTAG_APPL_METHOD("REGISTER"),
NUTAG_APPL_METHOD("NOTIFY"),
NUTAG_APPL_METHOD("INFO"),
+ NUTAG_APPL_METHOD("ACK"),
#ifdef MANUAL_BYE
NUTAG_APPL_METHOD("BYE"),
#endif
NUTAG_AUTOANSWER(0),
+ NUTAG_AUTOACK(0),
NUTAG_AUTOALERT(0),
NUTAG_ENABLEMESSENGER(1),
TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")),
@@ -924,6 +1130,7 @@
NUTAG_APPL_METHOD("OPTIONS"),
NUTAG_APPL_METHOD("REFER"),
NUTAG_AUTOANSWER(0),
+ NUTAG_AUTOACK(0),
NUTAG_AUTOALERT(0),
TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")),
TAG_IF((profile->mflags & MFLAG_REFER), NUTAG_ALLOW("REFER")),
@@ -1215,7 +1422,7 @@
char *name = (char *) switch_xml_attr_soft(gateway_tag, "name");
sofia_gateway_t *gateway;
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
name = "anonymous";
}
@@ -1379,33 +1586,33 @@
parse_gateway_subscriptions(profile, gateway, gw_subs_tag);
}
- if (switch_strlen_zero(realm)) {
- if (switch_strlen_zero(proxy)) {
+ if (zstr(realm)) {
+ if (zstr(proxy)) {
realm = name;
} else {
realm = proxy;
}
}
- if (switch_strlen_zero(username)) {
+ if (zstr(username)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: username param is REQUIRED!\n");
goto skip;
}
- if (switch_strlen_zero(password)) {
+ if (zstr(password)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: password param is REQUIRED!\n");
goto skip;
}
- if (switch_strlen_zero(from_user)) {
+ if (zstr(from_user)) {
from_user = username;
}
- if (switch_strlen_zero(extension)) {
+ if (zstr(extension)) {
extension = username;
}
- if (switch_strlen_zero(proxy)) {
+ if (zstr(proxy)) {
proxy = realm;
}
@@ -1414,11 +1621,11 @@
gateway->status = SOFIA_GATEWAY_UP;
}
- if (switch_strlen_zero(auth_username)) {
+ if (zstr(auth_username)) {
auth_username = username;
}
- if (!switch_strlen_zero(register_proxy)) {
+ 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);
} else {
@@ -1426,7 +1633,7 @@
}
}
- if (!switch_strlen_zero(outbound_proxy)) {
+ if (!zstr(outbound_proxy)) {
if (strncasecmp(outbound_proxy, "sip:", 4) && strncasecmp(outbound_proxy, "sips:", 5)) {
gateway->outbound_sticky_proxy = switch_core_sprintf(gateway->pool, "sip:%s", outbound_proxy);
} else {
@@ -1457,21 +1664,21 @@
if (contact_params) {
if (*contact_params == ';') {
- params = switch_core_sprintf(gateway->pool, "%s;transport=%s", contact_params, register_transport);
+ params = switch_core_sprintf(gateway->pool, "%s;transport=%s;gw=%s", contact_params, register_transport, gateway->name);
} else {
- params = switch_core_sprintf(gateway->pool, ";%s;transport=%s", contact_params, register_transport);
+ params = switch_core_sprintf(gateway->pool, ";%s;transport=%s;gw=%s", contact_params, register_transport, gateway->name);
}
} else {
- params = switch_core_sprintf(gateway->pool, ";transport=%s", register_transport);
+ params = switch_core_sprintf(gateway->pool, ";transport=%s;gw=%s", register_transport, gateway->name);
}
- if (!switch_strlen_zero(from_domain)) {
+ if (!zstr(from_domain)) {
gateway->from_domain = switch_core_strdup(gateway->pool, from_domain);
}
gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s", proxy);
gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>",
- from_user, !switch_strlen_zero(from_domain) ? from_domain : proxy, register_transport);
+ from_user, !zstr(from_domain) ? from_domain : proxy, register_transport);
sipip = contact_host ? contact_host : profile->extsipip ? profile->extsipip : profile->sipip;
@@ -1609,6 +1816,7 @@
profile->reg_acl_count = 0;
profile->proxy_acl_count = 0;
sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
+ sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
profile->ib_calls = 0;
profile->ob_calls = 0;
profile->ib_failed_calls = 0;
@@ -1626,6 +1834,12 @@
profile->debug = atoi(val);
} else if (!strcasecmp(var, "tracelevel")) {
mod_sofia_globals.tracelevel = switch_log_str2level(val);
+ } else if (!strcasecmp(var, "pass-callee-id")) {
+ if (switch_true(val)) {
+ sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
+ } else {
+ sofia_clear_pflag(profile, PFLAG_PASS_CALLEE_ID);
+ }
} else if (!strcasecmp(var, "sip-trace")) {
if (switch_true(val)) {
sofia_set_flag(profile, TFLAG_TPORT_LOG);
@@ -1661,6 +1875,8 @@
profile->cid_type = sofia_cid_name2type(val);
} else if (!strcasecmp(var, "record-template")) {
profile->record_template = switch_core_strdup(profile->pool, val);
+ } else if (!strcasecmp(var, "record-path")) {
+ profile->record_path = switch_core_strdup(profile->pool, val);
} else if ((!strcasecmp(var, "inbound-no-media") || !strcasecmp(var, "inbound-bypass-media"))) {
if (switch_true(val)) {
sofia_set_flag(profile, TFLAG_INB_NOMEDIA);
@@ -1989,7 +2205,7 @@
const char *parse = switch_xml_attr_soft(domain_tag, "parse");
const char *alias = switch_xml_attr_soft(domain_tag, "alias");
- if (!switch_strlen_zero(dname)) {
+ 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) {
@@ -2012,7 +2228,7 @@
if ((aliases_tag = switch_xml_child(xprofile, "aliases"))) {
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 (!switch_strlen_zero(aname)) {
+ 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);
@@ -2068,7 +2284,7 @@
su_log_redirect(stun_log, logger, NULL);
}
- if (!switch_strlen_zero(profile_name) && (profile = sofia_glue_find_profile(profile_name))) {
+ if (!zstr(profile_name) && (profile = sofia_glue_find_profile(profile_name))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Profile [%s] Already exists.\n", switch_str_nil(profile_name));
status = SWITCH_STATUS_FALSE;
sofia_glue_release_profile(profile);
@@ -2163,6 +2379,7 @@
sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER);
sofia_set_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
profile->contact_user = SOFIA_DEFAULT_CONTACT_USER;
+ sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -2174,7 +2391,7 @@
profile->debug = atoi(val);
} else if (!strcasecmp(var, "sip-trace") && switch_true(val)) {
sofia_set_flag(profile, TFLAG_TPORT_LOG);
- } else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
if (switch_odbc_available()) {
profile->odbc_dsn = switch_core_strdup(profile->pool, val);
if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
@@ -2212,6 +2429,8 @@
profile->cid_type = sofia_cid_name2type(val);
} else if (!strcasecmp(var, "record-template")) {
profile->record_template = switch_core_strdup(profile->pool, val);
+ } else if (!strcasecmp(var, "record-path")) {
+ profile->record_path = switch_core_strdup(profile->pool, val);
} else if ((!strcasecmp(var, "inbound-no-media") || !strcasecmp(var, "inbound-bypass-media")) && switch_true(val)) {
sofia_set_flag(profile, TFLAG_INB_NOMEDIA);
} else if (!strcasecmp(var, "inbound-late-negotiation") && switch_true(val)) {
@@ -2297,7 +2516,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val);
}
} else if (!strcasecmp(var, "ext-rtp-ip")) {
- if (!switch_strlen_zero(val)) {
+ if (!zstr(val)) {
char *ip = mod_sofia_globals.guess_ip;
if (!strcmp(val, "0.0.0.0")) {
@@ -2331,7 +2550,7 @@
}
profile->sipip = switch_core_strdup(profile->pool, ip);
} else if (!strcasecmp(var, "ext-sip-ip")) {
- if (!switch_strlen_zero(val)) {
+ if (!zstr(val)) {
char *ip = mod_sofia_globals.guess_ip;
char stun_ip[50] = "";
char *myip = stun_ip;
@@ -2546,6 +2765,18 @@
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_SIPCOMPACT);
}
+ } else if (!strcasecmp(var, "pass-callee-id")) {
+ if (switch_true(val)) {
+ sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
+ } else {
+ sofia_clear_pflag(profile, PFLAG_PASS_CALLEE_ID);
+ }
+ } else if (!strcasecmp(var, "sql-in-transactions")) {
+ if (switch_true(val)) {
+ sofia_set_pflag(profile, PFLAG_SQL_IN_TRANS);
+ } else {
+ sofia_clear_pflag(profile, PFLAG_SQL_IN_TRANS);
+ }
} else if (!strcasecmp(var, "bitpacking")) {
if (!strcasecmp(val, "aal2")) {
profile->codec_flags = SWITCH_CODEC_FLAG_AAL2;
@@ -2835,7 +3066,7 @@
const char *parse = switch_xml_attr_soft(domain_tag, "parse");
const char *alias = switch_xml_attr_soft(domain_tag, "alias");
- if (!switch_strlen_zero(dname)) {
+ 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) {
@@ -2858,7 +3089,7 @@
if ((aliases_tag = switch_xml_child(xprofile, "aliases"))) {
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 (!switch_strlen_zero(aname)) {
+ 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);
@@ -2911,7 +3142,7 @@
{
sofia_gateway_t *gateway = NULL;
- if (sofia_private && !switch_strlen_zero(sofia_private->gateway_name)) {
+ if (sofia_private && !zstr(sofia_private->gateway_name)) {
gateway = sofia_reg_find_gateway(sofia_private->gateway_name);
sofia_private->destroy_me = 1;
}
@@ -2969,8 +3200,16 @@
}
switch_channel_clear_flag(channel, CF_REQ_MEDIA);
-
+
if ((status == 180 || status == 183 || status == 200)) {
+ const char *x_freeswitch_support;
+
+ switch_channel_set_flag(channel, CF_MEDIA_ACK);
+
+ if ((x_freeswitch_support = sofia_glue_get_unknown_header(sip, "X-FS-Support"))) {
+ tech_pvt->x_freeswitch_support_remote = switch_core_session_strdup(session, x_freeswitch_support);
+ }
+
if (sip->sip_user_agent && sip->sip_user_agent->g_string) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
} else if (sip->sip_server && sip->sip_server->g_string) {
@@ -2978,6 +3217,10 @@
}
sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
+
+ if (sip_p_asserted_identity(sip)) {
+ sofia_update_callee_id(session, profile, sip, SWITCH_FALSE);
+ }
}
if (channel && sip && (status == 300 || status == 302 || status == 305) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
@@ -3107,6 +3350,7 @@
full_contact = sip_header_as_string(home, (void *) sip->sip_contact);
invite_contact = sofia_glue_strip_uri(full_contact);
+ switch_channel_set_variable(channel, "sip_redirected_to", invite_contact);
tech_pvt->redirected = switch_core_session_strdup(session, invite_contact);
free(invite_contact);
@@ -3128,7 +3372,7 @@
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 = { 0 };
+ 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)) {
@@ -3139,23 +3383,17 @@
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase);
- msg.message_id = SWITCH_MESSAGE_INDICATE_RESPOND;
- msg.from = __FILE__;
- msg.numeric_arg = status;
- msg.string_arg = switch_core_session_strdup(other_session, 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->pointer_arg = switch_core_session_strdup(other_session, r_sdp);
+ msg->pointer_arg_size = strlen(r_sdp);
}
- switch_mutex_unlock(tech_pvt->sofia_mutex);
- status = switch_core_session_receive_message(other_session, &msg);
- switch_mutex_lock(tech_pvt->sofia_mutex);
-
- if (status != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Other leg is not available\n");
- nua_respond(tech_pvt->nh, 403, "Hangup in progress", TAG_END());
- }
+ switch_core_session_queue_message(other_session, msg);
switch_core_session_rwunlock(other_session);
}
return;
@@ -3231,7 +3469,6 @@
}
}
-
}
if (!session && (status == 180 || status == 183 || status == 200)) {
@@ -3299,6 +3536,8 @@
switch_core_session_t *other_session = NULL;
switch_channel_t *other_channel = NULL;
char st[80] = "";
+ int is_dup_sdp = 0;
+ switch_event_t *s_event = NULL;
tl_gets(tags,
NUTAG_CALLSTATE_REF(ss_state),
@@ -3308,6 +3547,8 @@
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 (ss_state == nua_callstate_terminated) {
if ((status == 300 || status == 302 || status == 305) && session) {
@@ -3338,24 +3579,37 @@
goto done;
}
+ 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);
+ goto done;
+ }
+
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;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote SDP:\n%s\n", r_sdp);
+ tech_pvt->remote_sdp_str = switch_core_session_strdup(session, r_sdp);
+ switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote SDP:\n%s\n", r_sdp);
- tech_pvt->remote_sdp_str = switch_core_session_strdup(session, r_sdp);
- switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
-
- if ( sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && (parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
- if ((sdp = sdp_session(parser))) {
- sofia_glue_set_r_sdp_codec_string(channel, (tech_pvt->profile?tech_pvt->profile->codec_string:NULL), sdp);
+ if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && (parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
+ if ((sdp = sdp_session(parser))) {
+ sofia_glue_set_r_sdp_codec_string(channel, (tech_pvt->profile?tech_pvt->profile->codec_string:NULL), sdp);
+ }
+ sdp_parser_free(parser);
}
- sdp_parser_free(parser);
+ sofia_glue_pass_sdp(tech_pvt, (char *) r_sdp);
}
- sofia_glue_pass_sdp(tech_pvt, (char *) r_sdp);
}
}
@@ -3403,23 +3657,6 @@
case nua_callstate_proceeding:
if (status == 180) {
switch_channel_mark_ring_ready(channel);
- if (!switch_channel_test_flag(channel, CF_GEN_RINGBACK)) {
- if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
- if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
- && (other_session = switch_core_session_locate(uuid))) {
- switch_core_session_message_t msg;
- msg.message_id = SWITCH_MESSAGE_INDICATE_RINGING;
- msg.from = __FILE__;
- switch_mutex_unlock(tech_pvt->sofia_mutex);
- switch_core_session_receive_message(other_session, &msg);
- switch_mutex_lock(tech_pvt->sofia_mutex);
- switch_core_session_rwunlock(other_session);
- }
-
- } else {
- switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
- }
- }
}
if (r_sdp) {
@@ -3435,7 +3672,7 @@
goto done;
}
}
- if (!switch_channel_test_flag(channel, CF_GEN_RINGBACK) && (uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
+ if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
&& (other_session = switch_core_session_locate(uuid))) {
other_channel = switch_core_session_get_channel(other_session);
if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
@@ -3460,7 +3697,9 @@
}
break;
case nua_callstate_completing:
- nua_ack(nh, TAG_END());
+ nua_ack(tech_pvt->nh,
+ TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+ TAG_END());
break;
case nua_callstate_received:
if (!sofia_test_flag(tech_pvt, TFLAG_SDP)) {
@@ -3571,12 +3810,13 @@
//3PCC proxy mode delays the 200 OK until the call is answered
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
- sofia_glue_tech_choose_port(tech_pvt, 0);
- sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ //sofia_glue_tech_choose_port(tech_pvt, 0);
+ //sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
switch_channel_set_flag(channel, TFLAG_LATE_NEGOTIATION);
//Moves into CS_INIT so call moves forward into the dialplan
switch_channel_set_state(channel, CS_INIT);
} else {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "No SDP in INVITE and 3pcc not enabled, hanging up.\n");
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "3PCC DISABLED");
switch_channel_hangup(channel, SWITCH_CAUSE_MANDATORY_IE_MISSING);
}
@@ -3600,7 +3840,7 @@
if (r_sdp) {
sdp_parser_t *parser;
sdp_session_t *sdp;
- uint8_t match = 0, is_ok = 1;
+ uint8_t match = 0, is_ok = 1, is_t38 = 0;
tech_pvt->hold_laps = 0;
if (r_sdp) {
@@ -3612,13 +3852,16 @@
goto done;
}
+ if (switch_stristr("m=image", r_sdp)) {
+ is_t38 = 1;
+ }
+
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))) {
- switch_core_session_message_t msg = { 0 };
+ switch_core_session_message_t *msg;
- if (profile->media_options & MEDIA_OPT_MEDIA_ON_HOLD) {
+ 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);
@@ -3659,9 +3902,10 @@
goto done;
}
- msg.message_id = SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT;
- msg.from = __FILE__;
- msg.string_arg = (char *) r_sdp;
+ 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)) {
@@ -3674,22 +3918,19 @@
switch_channel_presence(tech_pvt->channel, "unknown", "hold", NULL);
}
- switch_mutex_unlock(tech_pvt->sofia_mutex);
- status = switch_core_session_receive_message(other_session, &msg);
- switch_mutex_lock(tech_pvt->sofia_mutex);
+ switch_core_session_queue_message(other_session, msg);
- if (status != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Other leg is not available\n");
- nua_respond(tech_pvt->nh, 403, "Hangup in progress", TAG_END());
- }
switch_core_session_rwunlock(other_session);
} else {
- 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");
+ 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);
}
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))) {
@@ -3703,19 +3944,21 @@
goto done;
}
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
- sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
+
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;
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Processing Reinvite\n");
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Processing updated SDP\n");
} else {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Reinvite Codec Error!\n");
is_ok = 0;
}
}
+
if (is_ok) {
if (tech_pvt->local_crypto_key) {
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
@@ -3726,6 +3969,11 @@
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 (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);
+ }
} else {
nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
}
@@ -3733,7 +3981,43 @@
}
break;
case nua_callstate_ready:
+ if (r_sdp && !is_dup_sdp && switch_rtp_ready(tech_pvt->rtp_session)) {
+ /* sdp changed since 18X w sdp, we're supposed to ignore it but we, of course, were pressured into supporting it */
+ sdp_parser_t *parser;
+ sdp_session_t *sdp;
+ 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))) {
+ match = sofia_glue_negotiate_sdp(session, sdp);
+ }
+ sdp_parser_free(parser);
+ }
+ }
+ if (match) {
+ if (sofia_glue_tech_choose_port(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
+ 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, "RTP Error!\n");
+ goto done;
+ switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Processing updated SDP\n");
+ }
+ } else {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error!\n");
+ goto done;
+
+ }
+ }
+
if (r_sdp && sofia_test_flag(tech_pvt, TFLAG_NOSDP_REINVITE)) {
sdp_parser_t *parser;
sdp_session_t *sdp;
@@ -3999,6 +4283,34 @@
/*---------------------------------------*/
+static switch_status_t xfer_hanguphook(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);
+
+ 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)) {
+ switch_channel_hangup(kchannel, SWITCH_CAUSE_NORMAL_CLEARING);
+ }
+
+ switch_core_session_rwunlock(ksession);
+ }
+
+ switch_core_event_hook_remove_state_change(session, xfer_hanguphook);
+
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
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 */
@@ -4031,6 +4343,10 @@
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());
+
if (sip->sip_referred_by) {
full_ref_by = sip_header_as_string(home, (void *) sip->sip_referred_by);
}
@@ -4095,10 +4411,79 @@
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;
+ }
- if (br_a && br_b) {
- switch_core_session_t *new_b_session = NULL, *a_session = NULL, *tmp = NULL;
+ 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,
+ "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);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+
+ 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);
+ const char *tmp;
+
+ switch_core_event_hook_add_state_change(a_session, xfer_hanguphook);
+ switch_channel_set_variable(a_channel, "att_xfer_kill_uuid", switch_core_session_get_uuid(b_session));
+
+ if ((tmp = switch_channel_get_variable(a_channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
+ moh = tmp;
+ }
+
+ if (!strcasecmp(moh, "silence")) {
+ moh = NULL;
+ }
+
+ if (moh) {
+ char *xdest;
+ xdest = switch_core_session_sprintf(a_session, "endless_playback:%s,park", moh);
+ switch_ivr_session_transfer(a_session, xdest, "inline", NULL);
+ } 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());
+
+ if (b_tech_pvt) {
+ 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());
+ }
+ } else {
+ 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());
+ }
+
+ } 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));
@@ -4116,20 +4501,9 @@
sofia_clear_flag_locked(b_tech_pvt, TFLAG_SIP_HOLD);
sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
- switch_channel_set_variable(switch_core_session_get_channel(b_session), "park_timeout", "2");
- switch_channel_set_state(switch_core_session_get_channel(b_session), CS_PARK);
-
- new_b_session = switch_core_session_locate(br_b);
- a_session = switch_core_session_locate(br_a);
- sofia_info_send_sipfrag(a_session, new_b_session);
-
- if (new_b_session) {
- switch_core_session_rwunlock(new_b_session);
- }
-
- if (a_session) {
- switch_core_session_rwunlock(a_session);
- }
+ 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");
@@ -4155,17 +4529,23 @@
if (t_session) {
switch_channel_t *t_channel = switch_core_session_get_channel(t_session);
+ const char *idest = switch_channel_get_variable(hup_channel, "inline_destination");
ext = switch_channel_get_variable(hup_channel, "destination_number");
- if (!switch_strlen_zero(full_ref_by)) {
+ if (!zstr(full_ref_by)) {
switch_channel_set_variable(t_channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by);
}
- if (!switch_strlen_zero(full_ref_to)) {
+ if (!zstr(full_ref_to)) {
switch_channel_set_variable(t_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
}
-
- switch_ivr_session_transfer(t_session, ext, NULL, NULL);
+
+ 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"),
@@ -4200,7 +4580,7 @@
port = refer_to->r_url->url_port;
}
- if (switch_strlen_zero(port)) {
+ if (zstr(port)) {
port = "5060";
}
@@ -4240,11 +4620,11 @@
switch_channel_set_variable(channel, SOFIA_REPLACES_HEADER, rep);
- if (!switch_strlen_zero(full_ref_by)) {
+ if (!zstr(full_ref_by)) {
switch_channel_set_variable(channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by);
}
- if (!switch_strlen_zero(full_ref_to)) {
+ if (!zstr(full_ref_to)) {
switch_channel_set_variable(channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
}
@@ -4287,10 +4667,10 @@
if ((b_session = switch_core_session_locate(br))) {
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
switch_channel_set_variable(channel, "transfer_fallback_extension", from->a_user);
- if (!switch_strlen_zero(full_ref_by)) {
+ if (!zstr(full_ref_by)) {
switch_channel_set_variable(b_channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by);
}
- if (!switch_strlen_zero(full_ref_to)) {
+ if (!zstr(full_ref_to)) {
switch_channel_set_variable(b_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
}
@@ -4375,6 +4755,8 @@
} else if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "dtmf")) {
int tmp = atoi(sip->sip_payload->pl_data);
dtmf.digit = switch_rfc2833_to_char(tmp);
+ } else if (!strncasecmp(sip->sip_content_type->c_type, "message", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "update_display")) {
+ sofia_update_callee_id(session, profile, sip, SWITCH_TRUE);
} else {
goto end;
}
@@ -4409,7 +4791,7 @@
}
if ((clientcode_header = sofia_glue_get_unknown_header(sip, "x-clientcode"))) {
- if (!switch_strlen_zero(clientcode_header)) {
+ if (!zstr(clientcode_header)) {
switch_channel_set_variable(channel, "call_clientcode", clientcode_header);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Setting CMC to %s\n", clientcode_header);
nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
@@ -4418,17 +4800,20 @@
}
if ((rec_header = sofia_glue_get_unknown_header(sip, "record"))) {
- if (switch_strlen_zero(profile->record_template)) {
+ if (zstr(profile->record_template)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Record attempted but no template defined.\n");
nua_respond(nh, 488, "Recording not enabled", NUTAG_WITH_THIS(nua), TAG_END());
} else {
if (!strcasecmp(rec_header, "on")) {
- char *file;
+ char *file = NULL, *tmp = NULL;
- file = switch_channel_expand_variables(channel, profile->record_template);
+ tmp = switch_mprintf("%s%s%s", profile->record_path ? profile->record_path : "${base_dir}/recordings",
+ 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_safe_free(tmp);
nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
if (file != profile->record_template) {
free(file);
@@ -4528,16 +4913,16 @@
user = url->url_user;
host = url->url_host;
port = url->url_port;
- if (!switch_strlen_zero(url->url_params)) {
+ if (!zstr(url->url_params)) {
switch_channel_set_variable(channel, params_var, url->url_params);
}
}
- if (switch_strlen_zero(user)) {
+ if (zstr(user)) {
user = "nobody";
}
- if (switch_strlen_zero(host)) {
+ if (zstr(host)) {
host = "nowhere";
}
@@ -4596,6 +4981,7 @@
char *is_nat = NULL;
char acl_token[512] = "";
sofia_transport_t transport;
+ const char *gw_name = NULL;
profile->ib_calls++;
@@ -4643,7 +5029,7 @@
contact_host = sip->sip_contact->m_url->url_host;
}
- if (!switch_strlen_zero(contact_host)) {
+ if (!zstr(contact_host)) {
for (x = 0; x < profile->nat_acl_count; x++) {
last_acl = profile->nat_acl[x];
if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
@@ -4709,7 +5095,7 @@
"found auth ip [%s] header of [%s]\n",
un->un_name, un->un_value
);
- if (!switch_strlen_zero(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))) {
@@ -4856,7 +5242,7 @@
from_host = sip->sip_from->a_url->url_host;
channel_name = url_set_chanvars(session, sip->sip_from->a_url, sip_from);
- if (!switch_strlen_zero(from_user)) {
+ if (!zstr(from_user)) {
if (*from_user == '+') {
switch_channel_set_variable(channel, "sip_from_user_stripped", (const char *) (from_user + 1));
} else {
@@ -4873,10 +5259,10 @@
switch_channel_set_variable(channel, "sofia_profile_name", profile->name);
switch_channel_set_variable(channel, "sofia_profile_domain_name", profile->domain_name);
- if (!switch_strlen_zero(sip->sip_from->a_display)) {
+ if (!zstr(sip->sip_from->a_display)) {
displayname = sip->sip_from->a_display;
} else {
- displayname = switch_strlen_zero(from_user) ? "unknown" : from_user;
+ displayname = zstr(from_user) ? "unknown" : from_user;
}
}
@@ -4884,12 +5270,12 @@
if (rpid->rpid_url && rpid->rpid_url->url_user) {
char *full_rpid_header = sip_header_as_string(nh->nh_home, (void *) rpid);
from_user = rpid->rpid_url->url_user;
- if (!switch_strlen_zero(full_rpid_header)) {
+ if (!zstr(full_rpid_header)) {
switch_channel_set_variable(channel, "sip_Remote-Party-ID", full_rpid_header);
}
}
- if (!switch_strlen_zero(rpid->rpid_display)) {
+ if (!zstr(rpid->rpid_display)) {
displayname = rpid->rpid_display;
}
switch_channel_set_variable(channel, "sip_cid_type", "rpid");
@@ -4899,11 +5285,11 @@
if (passerted->paid_url && passerted->paid_url->url_user) {
char *full_paid_header = sip_header_as_string(nh->nh_home, (void *) passerted);
from_user = passerted->paid_url->url_user;
- if (!switch_strlen_zero(full_paid_header)) {
+ if (!zstr(full_paid_header)) {
switch_channel_set_variable(channel, "sip_P-Asserted-Identity", from_user);
}
}
- if (!switch_strlen_zero(passerted->paid_display)) {
+ if (!zstr(passerted->paid_display)) {
displayname = passerted->paid_display;
}
switch_channel_set_variable(channel, "sip_cid_type", "pid");
@@ -4913,12 +5299,12 @@
if (ppreferred->ppid_url && ppreferred->ppid_url->url_user) {
char *full_ppid_header = sip_header_as_string(nh->nh_home, (void *) ppreferred);
from_user = ppreferred->ppid_url->url_user;
- if (!switch_strlen_zero(full_ppid_header)) {
+ if (!zstr(full_ppid_header)) {
switch_channel_set_variable(channel, "sip_P-Preferred-Identity", full_ppid_header);
}
}
- if (!switch_strlen_zero(ppreferred->ppid_display)) {
+ if (!zstr(ppreferred->ppid_display)) {
displayname = ppreferred->ppid_display;
}
switch_channel_set_variable(channel, "sip_cid_type", "pid");
@@ -5063,7 +5449,7 @@
check_decode(referred_by_user, session);
- if (!switch_strlen_zero(referred_by_user)) {
+ if (!zstr(referred_by_user)) {
if (*referred_by_user == '+') {
switch_channel_set_variable(channel, "sip_referred_by_user_stripped", (const char *) (referred_by_user + 1));
} else {
@@ -5100,7 +5486,7 @@
switch_channel_set_variable(channel, "sip_subject", sip->sip_subject->g_string);
}
- if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)) {
+ if (sip->sip_user_agent && !zstr(sip->sip_user_agent->g_string)) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
}
@@ -5163,16 +5549,29 @@
free(tmp);
}
+
+ if (sip->sip_request->rq_url->url_params) {
+ gw_name = sofia_glue_find_parameter(sip->sip_request->rq_url->url_params, "gw=");
+ }
if (strstr(destination_number, "gw+")) {
- const char *gw_name = destination_number + 3;
+ gw_name = destination_number + 3;
+ }
+
+ if (gw_name) {
sofia_gateway_t *gateway;
if (gw_name && (gateway = sofia_reg_find_gateway(gw_name))) {
context = switch_core_session_strdup(session, gateway->register_context);
switch_channel_set_variable(channel, "sip_gateway", gateway->name);
if (gateway->extension) {
- destination_number = switch_core_session_strdup(session, gateway->extension);
+ if (!strcasecmp(gateway->extension, "auto_to_user")) {
+ destination_number = sip->sip_to->a_url->url_user;
+ } else {
+ destination_number = switch_core_session_strdup(session, gateway->extension);
+ }
+ } else {
+ destination_number = sip->sip_to->a_url->url_user;
}
gateway->ib_calls++;
@@ -5294,7 +5693,7 @@
if ((privacy = sip_privacy(sip))) {
char *full_priv_header = sip_header_as_string(nh->nh_home, (void *) privacy);
- if (!switch_strlen_zero(full_priv_header)) {
+ if (!zstr(full_priv_header)) {
switch_channel_set_variable(channel, "sip_Privacy", full_priv_header);
}
if (msg_params_find(privacy->priv_values, "id")) {
@@ -5307,7 +5706,7 @@
if (!strncasecmp(un->un_name, "Diversion", 9)) {
/* Basic Diversion Support for Diversion Indication in SIP */
/* draft-levy-sip-diversion-08 */
- if (!switch_strlen_zero(un->un_value)) {
+ if (!zstr(un->un_value)) {
char *tmp_name;
if ((tmp_name = switch_mprintf("%s%s", SOFIA_SIP_HEADER_PREFIX, un->un_name))) {
switch_channel_set_variable(channel, tmp_name, un->un_value);
@@ -5316,8 +5715,10 @@
}
} else if (!strncasecmp(un->un_name, "History-Info", 12)) {
switch_channel_set_variable(channel, "sip_history_info", un->un_value);
+ } else if (!strcasecmp(un->un_name, "X-FS-Support")) {
+ tech_pvt->x_freeswitch_support_remote = switch_core_session_strdup(session, un->un_value);
} else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2)) {
- if (!switch_strlen_zero(un->un_value)) {
+ if (!zstr(un->un_value)) {
char new_name[512] = "";
int reps = 0;
for(;;) {
@@ -5454,7 +5855,7 @@
nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
}
-static void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg)
+void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg)
{
private_object_t *b_tech_pvt = NULL, *a_tech_pvt = NULL;
char message[256] = "";
@@ -5470,22 +5871,27 @@
switch_caller_profile_t *acp = a_tech_pvt->caller_profile;
if (ua && switch_stristr("snom", ua)) {
- if (switch_strlen_zero(acp->caller_id_name)) {
+ if (zstr(acp->caller_id_name)) {
snprintf(message, sizeof(message), "From:\r\nTo: %s\r\n", acp->caller_id_number);
} else {
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"), SIPTAG_PAYLOAD_STR(message), TAG_END());
+ 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());
} else if (ua && switch_stristr("polycom", ua)) {
- if (switch_strlen_zero(acp->caller_id_name)) {
+ 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(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
+ 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_experimental_refactor/src/mod/endpoints/mod_sofia/sofia_glue.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/sofia_glue.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/sofia_glue.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -178,7 +178,7 @@
tech_pvt->owner_id, tech_pvt->session_id, family, ip, username, family, ip,
srbuf,
port,
- (!switch_strlen_zero(tech_pvt->local_crypto_key)
+ (!zstr(tech_pvt->local_crypto_key)
&& sofia_test_flag(tech_pvt,TFLAG_SECURE)) ? "S" : "");
if (tech_pvt->rm_encoding) {
@@ -276,7 +276,7 @@
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=%s\n", sr);
}
- if (!switch_strlen_zero(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
+ 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);
//switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n");
#if 0
@@ -444,6 +444,7 @@
}
}
+
if (codec_string) {
char *tmp_codec_string;
if ((tmp_codec_string = switch_core_session_strdup(tech_pvt->session, codec_string))) {
@@ -495,6 +496,8 @@
tech_pvt->flags[x] = profile->flags[x];
}
+ tech_pvt->x_freeswitch_support_local = FREESWITCH_SUPPORT;
+
tech_pvt->profile = profile;
profile->inuse++;
switch_mutex_unlock(profile->flag_mutex);
@@ -518,6 +521,10 @@
tech_pvt->session = session;
tech_pvt->channel = switch_core_session_get_channel(session);
+ 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);
@@ -564,7 +571,7 @@
}
}
- if (switch_strlen_zero(stun_ip)) {
+ if (zstr(stun_ip)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "STUN Failed! NO STUN SERVER\n");
goto out;
}
@@ -625,7 +632,7 @@
sip_unknown_t *un;
for (un = sip->sip_unknown; un; un = un->un_next) {
if (!strcasecmp(un->un_name, name)) {
- if (!switch_strlen_zero(un->un_value)) {
+ if (!zstr(un->un_value)) {
return un->un_value;
}
}
@@ -663,7 +670,7 @@
sdp_port = tech_pvt->local_sdp_audio_port;
if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip"))
- && !switch_strlen_zero(tech_pvt->profile->extrtpip)) {
+ && !zstr(tech_pvt->profile->extrtpip)) {
use_ip = tech_pvt->profile->extrtpip;
}
@@ -731,7 +738,7 @@
sdp_port = tech_pvt->local_sdp_video_port;
if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_video_ip"))
- && !switch_strlen_zero(tech_pvt->profile->extrtpip)) {
+ && !zstr(tech_pvt->profile->extrtpip)) {
use_ip = tech_pvt->profile->extrtpip;
}
@@ -998,7 +1005,7 @@
int x;
const char *val;
- if (switch_strlen_zero(tech_pvt->remote_sdp_str)) {
+ if (zstr(tech_pvt->remote_sdp_str)) {
return SWITCH_STATUS_FALSE;
}
@@ -1130,7 +1137,7 @@
char *new_sdp;
int bad = 0;
- if (switch_strlen_zero(tech_pvt->local_sdp_str)) {
+ if (zstr(tech_pvt->local_sdp_str)) {
return;
}
@@ -1141,7 +1148,7 @@
return;
}
- if (switch_strlen_zero(tech_pvt->adv_sdp_audio_ip) || !tech_pvt->adv_sdp_audio_port) {
+ 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));
return;
@@ -1353,7 +1360,7 @@
switch_channel_variable_last(channel);
}
- if (!switch_strlen_zero((char*)stream.data)) {
+ if (!zstr((char*)stream.data)) {
extra_headers = stream.data;
} else {
switch_safe_free(stream.data);
@@ -1373,7 +1380,7 @@
for (un = sip->sip_unknown; un; un = un->un_next) {
if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2)) {
- if (!switch_strlen_zero(un->un_value)) {
+ if (!zstr(un->un_value)) {
switch_snprintf(name, sizeof(name), "%s%s", prefix, un->un_name);
switch_channel_set_variable(channel, name, un->un_value);
}
@@ -1441,7 +1448,7 @@
format,
cid_name,
cid_num,
- !switch_strlen_zero(cid_num) ? "@" : "",
+ !zstr(cid_num) ? "@" : "",
sipip);
}
@@ -1475,7 +1482,7 @@
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");
- if (switch_strlen_zero(tech_pvt->dest)) {
+ 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;
}
@@ -1494,15 +1501,15 @@
} else {
use_from_str = switch_core_session_sprintf(tech_pvt->session, "sip:%s", from_var);
}
- } else if (!switch_strlen_zero(tech_pvt->gateway_from_str)) {
+ } else if (!zstr(tech_pvt->gateway_from_str)) {
use_from_str = tech_pvt->gateway_from_str;
} else {
use_from_str = tech_pvt->from_str;
}
- if (!switch_strlen_zero(tech_pvt->gateway_from_str)) {
+ if (!zstr(tech_pvt->gateway_from_str)) {
rpid_domain = switch_core_session_strdup(session, tech_pvt->gateway_from_str);
- } else if (!switch_strlen_zero(tech_pvt->from_str)) {
+ } else if (!zstr(tech_pvt->from_str)) {
rpid_domain = switch_core_session_strdup(session, tech_pvt->from_str);
}
@@ -1522,7 +1529,7 @@
* 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()
*/
- if (tech_pvt->transport == SOFIA_TRANSPORT_UNKNOWN && switch_strlen_zero(tech_pvt->gateway_name)) {
+ if (tech_pvt->transport == SOFIA_TRANSPORT_UNKNOWN && zstr(tech_pvt->gateway_name)) {
if ((p = (char *) switch_stristr("port=", url))) {
p += 5;
tech_pvt->transport = sofia_glue_str2transport(p);
@@ -1546,7 +1553,7 @@
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(tech_pvt->invite_contact)) {
+ if (zstr(tech_pvt->invite_contact)) {
const char * contact;
if ((contact = switch_channel_get_variable(channel, "sip_contact_user"))) {
char *ip_addr;
@@ -1733,7 +1740,7 @@
sofia_glue_tech_patch_sdp(tech_pvt);
}
- if (!switch_strlen_zero(tech_pvt->dest)) {
+ if (!zstr(tech_pvt->dest)) {
dst = sofia_glue_get_destination(tech_pvt->dest);
if (dst->route_uri) {
@@ -1759,16 +1766,17 @@
NUTAG_AUTOANSWER(0),
NUTAG_SESSION_TIMER(session_timeout),
TAG_IF(tech_pvt->redirected, NUTAG_URL(tech_pvt->redirected)),
- TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
- TAG_IF(!switch_strlen_zero(tech_pvt->rpid), SIPTAG_REMOTE_PARTY_ID_STR(tech_pvt->rpid)),
- TAG_IF(!switch_strlen_zero(tech_pvt->preferred_id), SIPTAG_P_PREFERRED_IDENTITY_STR(tech_pvt->preferred_id)),
- TAG_IF(!switch_strlen_zero(tech_pvt->asserted_id), SIPTAG_P_ASSERTED_IDENTITY_STR(tech_pvt->asserted_id)),
- TAG_IF(!switch_strlen_zero(tech_pvt->privacy), SIPTAG_PRIVACY_STR(tech_pvt->privacy)),
- TAG_IF(!switch_strlen_zero(alert_info), SIPTAG_HEADER_STR(alert_info)),
- TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
- TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)),
- TAG_IF(!switch_strlen_zero(route_uri), NUTAG_PROXY(route_uri)),
- TAG_IF(!switch_strlen_zero(route), SIPTAG_ROUTE_STR(route)),
+ 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),
@@ -1820,7 +1828,7 @@
nua_invite(tech_pvt->nh2,
SIPTAG_CONTACT_STR(contact_url),
- TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+ TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
@@ -2313,7 +2321,7 @@
//const char *port = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
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, "Audio params are unchanged for %s.\n", switch_channel_get_name(tech_pvt->channel));
goto video;
@@ -2598,7 +2606,7 @@
char *codec_order[SWITCH_MAX_CODECS];
const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS] = { 0 };
- if (!switch_strlen_zero(codec_string)) {
+ if (!zstr(codec_string)) {
char *tmp_codec_string;
if ((tmp_codec_string = strdup(codec_string))) {
num_codecs = switch_separate_string(tmp_codec_string, ',', codec_order, SWITCH_MAX_CODECS);
@@ -2614,7 +2622,7 @@
}
for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
- if (switch_strlen_zero(attr->a_name)) {
+ if (zstr(attr->a_name)) {
continue;
}
@@ -2630,7 +2638,7 @@
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) {
- if (switch_strlen_zero(attr->a_name)) {
+ if (zstr(attr->a_name)) {
continue;
}
if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) {
@@ -2736,7 +2744,7 @@
switch_assert(tech_pvt != NULL);
switch_assert(r_sdp != NULL);
- if (switch_strlen_zero(r_sdp)) {
+ if (zstr(r_sdp)) {
return SWITCH_STATUS_FALSE;
}
@@ -2895,7 +2903,7 @@
}
for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
- if (switch_strlen_zero(attr->a_name)) {
+ if (zstr(attr->a_name)) {
continue;
}
@@ -2962,13 +2970,12 @@
} else if (m->m_type == sdp_media_audio && m->m_port && !got_audio) {
sdp_rtpmap_t *map;
-
for (attr = m->m_attributes; attr; attr = attr->a_next) {
if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) {
ptime = atoi(attr->a_value);
} else if (!strcasecmp(attr->a_name, "maxptime") && attr->a_value) {
maxptime = atoi(attr->a_value);
- } else if (!got_crypto && !strcasecmp(attr->a_name, "crypto") && !switch_strlen_zero(attr->a_value)) {
+ } else if (!got_crypto && !strcasecmp(attr->a_name, "crypto") && !zstr(attr->a_value)) {
int crypto_tag;
if (m->m_proto != sdp_proto_srtp) {
@@ -3023,7 +3030,7 @@
tech_pvt->crypto_tag = crypto_tag;
got_crypto++;
- if (switch_strlen_zero(tech_pvt->local_crypto_key)) {
+ if (zstr(tech_pvt->local_crypto_key)) {
if (switch_stristr(SWITCH_RTP_CRYPTO_KEY_32, crypto)) {
switch_channel_set_variable(tech_pvt->channel, SOFIA_HAS_CRYPTO_VARIABLE, SWITCH_RTP_CRYPTO_KEY_32);
sofia_glue_build_crypto(tech_pvt, atoi(crypto), AES_CM_128_HMAC_SHA1_32, SWITCH_RTP_CRYPTO_SEND);
@@ -3057,26 +3064,43 @@
greed:
x = 0;
- if (tech_pvt->rm_encoding) {
+ 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;
+
+ if (switch_rtp_ready(tech_pvt->rtp_session)) {
+ 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 (map->rm_pt < 96) {
+ if (zstr(map->rm_encoding) && map->rm_pt < 96) {
match = (map->rm_pt == tech_pvt->pt) ? 1 : 0;
} else {
match = strcasecmp(switch_str_nil(map->rm_encoding), tech_pvt->iananame) ? 0 : 1;
}
- if (match && connection->c_address && tech_pvt->remote_sdp_audio_ip &&
- !strcmp(connection->c_address, tech_pvt->remote_sdp_audio_ip) && m->m_port == tech_pvt->remote_sdp_audio_port) {
- 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;
+ if (match && connection->c_address && remote_host &&
+ !strcmp(connection->c_address, remote_host) && m->m_port == remote_port) {
+ same = 1;
+ } else {
+ same = 0;
break;
}
}
+
+ if (same) {
+ 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;
+ } else {
+ match = 0;
+ got_audio = 0;
+ }
}
-
-
-
+
for (map = m->m_rtpmaps; map; map = map->rm_next) {
int32_t i;
uint32_t near_rate = 0;
@@ -3136,7 +3160,7 @@
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u:%d]/[%s:%d:%u:%d]\n",
rm_encoding, map->rm_pt, (int) map->rm_rate, ptime,
imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000);
- if (map->rm_pt < 96) {
+ if (zstr(map->rm_encoding) && map->rm_pt < 96) {
match = (map->rm_pt == imp->ianacode) ? 1 : 0;
} else {
match = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
@@ -3202,7 +3226,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") && switch_strlen_zero((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 {
@@ -3597,7 +3621,9 @@
" network_ip VARCHAR(255),\n"
" network_port VARCHAR(6),\n"
" sip_username VARCHAR(255),\n"
- " sip_realm VARCHAR(255)\n"
+ " sip_realm VARCHAR(255),\n"
+ " mwi_user VARCHAR(255),\n"
+ " mwi_host VARCHAR(255)\n"
");\n";
@@ -3659,7 +3685,8 @@
" nonce VARCHAR(255),\n"
" expires INTEGER,"
" profile_name VARCHAR(255),\n"
- " hostname 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 */
@@ -3740,7 +3767,7 @@
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!='-1' and network_port!='-1' and sip_username != '-1'",
+ "and network_ip!='-1' and network_port!='-1' and sip_username != '-1' and mwi_user != '-1' and mwi_host != '-1'",
mod_sofia_globals.hostname);
if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
@@ -3773,7 +3800,7 @@
}
free(test_sql);
- test_sql = switch_mprintf("delete from sip_authentication where hostname='%q'", mod_sofia_globals.hostname);
+ test_sql = switch_mprintf("delete from sip_authentication where hostname='%q' and last_nc >= 0", mod_sofia_globals.hostname);
if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_authentication", NULL);
@@ -3813,7 +3840,7 @@
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!='-1' and network_port!='-1' and sip_username != '-1'",
+ "and network_ip!='-1' and network_port!='-1' and sip_username != '-1' and mwi_user != '-1' and mwi_host != '-1'",
mod_sofia_globals.hostname);
switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_registrations", reg_sql);
@@ -3831,7 +3858,7 @@
switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_presence", pres_sql);
free(test_sql);
- test_sql = switch_mprintf("delete from sip_authentication where hostname='%q'", mod_sofia_globals.hostname);
+ test_sql = switch_mprintf("delete from sip_authentication where hostname='%q' and last_nc >= 0", mod_sofia_globals.hostname);
switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_authentication", auth_sql);
free(test_sql);
@@ -3968,7 +3995,7 @@
if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
char *err_str;
err_str = switch_odbc_handle_get_error(profile->master_odbc, stmt);
- if (!switch_strlen_zero(err_str)) {
+ if (!zstr(err_str)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, err_str);
}
switch_safe_free(err_str);
@@ -4120,46 +4147,44 @@
int sofia_glue_get_user_host(char *in, char **user, char **host)
{
- char *p, *h, *u = in;
+ char *p = NULL, *h = NULL, *u = in;
- if (user) {
- *user = NULL;
+ if (!in) {
+ return 0;
}
- *host = NULL;
-
/* First isolate the host part from the user part */
if ((h = strchr(u, '@'))) {
*h++ = '\0';
- } else {
- return 0;
}
/* Clean out the user part of its protocol prefix (if any) */
- if (user && (p = strchr(u, ':'))) {
+ if ((p = strchr(u, ':'))) {
*p++ = '\0';
u = p;
}
/* Clean out the host part of any suffix */
- if ((p = strchr(h, ':'))) {
- *p = '\0';
+ if (h) {
+ if ((p = strchr(h, ':'))) {
+ *p = '\0';
+ }
+
+ if ((p = strchr(h, ';'))) {
+ *p = '\0';
+ }
+
+ if ((p = strchr(h, ' '))) {
+ *p = '\0';
+ }
}
-
- if ((p = strchr(h, ';'))) {
- *p = '\0';
+ if (user) {
+ *user = u;
}
-
- if ((p = strchr(h, ' '))) {
- *p = '\0';
+ if (host) {
+ *host = h;
}
- if (user) {
- *user = u;
- }
-
- *host = h;
-
return 1;
}
@@ -4201,7 +4226,7 @@
char *eoc = NULL;
char *p = NULL;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
return NULL;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/sofia_presence.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/sofia_presence.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/sofia_presence.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -68,7 +68,7 @@
goto end;
}
- if (!switch_strlen_zero(type)) {
+ if (!zstr(type)) {
ct = type;
}
@@ -96,9 +96,9 @@
goto end;
}
- if (switch_strlen_zero(host)) {
+ if (zstr(host)) {
host = profile->domain_name;
- if (switch_strlen_zero(host)) {
+ if (zstr(host)) {
host = prof;
}
}
@@ -123,9 +123,9 @@
*p++ = '\0';
}
- if (switch_strlen_zero(p)) {
+ if (zstr(p)) {
p = profile->domain_name;
- if (switch_strlen_zero(p)) {
+ if (zstr(p)) {
p = host;
}
}
@@ -345,11 +345,11 @@
if (for_everyone) {
sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' "
- "from sip_registrations where sip_user='%q' and sip_host='%q'",
+ "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 sip_user='%q' and sip_host='%q' and call_id='%q'",
+ "from sip_registrations where mwi_user='%q' and mwi_host='%q' and call_id='%q'",
stream.data, user, host, call_id);
}
@@ -463,11 +463,11 @@
return;
}
- if (switch_strlen_zero(event_type)) {
+ if (zstr(event_type)) {
event_type = "presence";
}
- if (switch_strlen_zero(alt_event_type)) {
+ if (zstr(alt_event_type)) {
alt_event_type = "presence";
}
@@ -625,7 +625,7 @@
switch_safe_free(sql);
- if (!switch_strlen_zero((char *) helper.stream.data)) {
+ if (!zstr((char *) helper.stream.data)) {
char *this_sql = (char *) helper.stream.data;
char *next = NULL;
char *last = NULL;
@@ -638,7 +638,7 @@
}
}
- if (!switch_strlen_zero(this_sql) && (!last || strcmp(last, this_sql))) {
+ if (!zstr(this_sql) && (!last || strcmp(last, this_sql))) {
sofia_glue_execute_sql(profile, &this_sql, SWITCH_FALSE);
last = this_sql;
}
@@ -839,13 +839,13 @@
switch_url_decode(to_buf);
to_user = to_buf;
}
- if (argc > 10 && !switch_strlen_zero(argv[9]) && !switch_strlen_zero(argv[10])) {
+ if (argc > 10 && !zstr(argv[9]) && !zstr(argv[10])) {
status = argv[9];
rpid = argv[10];
}
}
- if (switch_strlen_zero(proto)) {
+ if (zstr(proto)) {
proto = NULL;
}
@@ -863,11 +863,11 @@
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", 0);
- if (!switch_strlen_zero(to_user)) {
+ if (!zstr(to_user)) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to-user", to_user);
}
- if (switch_strlen_zero(state)) {
+ 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");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "resubscribe");
@@ -1004,7 +1004,7 @@
int kill_handle = 0;
char expires_str[10] = "";
- if (argc > 18 && !switch_strlen_zero(argv[17]) && !switch_strlen_zero(argv[18])) {
+ if (argc > 18 && !zstr(argv[17]) && !zstr(argv[18])) {
status = argv[17];
rpid = argv[18];
}
@@ -1012,11 +1012,11 @@
in = helper->event && helper->event->event_id == SWITCH_EVENT_PRESENCE_IN;
- if (switch_strlen_zero(rpid)) {
+ if (zstr(rpid)) {
rpid = "unknown";
}
- if (switch_strlen_zero(status)) {
+ if (zstr(status)) {
if (!strcasecmp(rpid, "busy")) {
status = "Busy";
} else if (!strcasecmp(rpid, "unavailable")) {
@@ -1135,9 +1135,9 @@
if (!strcasecmp(state, "cs_hangup")) {
astate = "terminated";
- } else if (switch_strlen_zero(astate)) {
+ } else if (zstr(astate)) {
astate = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
- if (switch_strlen_zero(astate)) {
+ if (zstr(astate)) {
if (is_dialog) {
astate = dft_state;
} else {
@@ -1171,7 +1171,7 @@
clean_from_user = switch_mprintf("%s", from_id ? from_id : from_user);
if (is_dialog) {
- if (!switch_strlen_zero(clean_to_user) && !switch_strlen_zero(clean_from_user)) {
+ if (!zstr(clean_to_user) && !zstr(clean_from_user)) {
stream.write_function(&stream, "<local>\n<identity display=\"%s\">sip:%s@%s</identity>\n", clean_to_user, clean_to_user, host);
stream.write_function(&stream, "<target uri=\"sip:%s@%s\">\n", clean_to_user, host);
stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"%s\"/>\n",
@@ -1183,7 +1183,7 @@
stream.write_function(&stream, "</remote>\n");
} else if (!strcasecmp(proto, "park")) {
stream.write_function(&stream, "<local>\n<identity display=\"parking\">sip:parking@%s;fifo=%s</identity>\n",
- host, !switch_strlen_zero(clean_to_user) ? clean_to_user : "unknown");
+ host, !zstr(clean_to_user) ? clean_to_user : "unknown");
stream.write_function(&stream, "<target uri=\"sip:parking@%s\">\n", host);
stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"no\"/>\n</target>\n</local>\n");
stream.write_function(&stream, "<remote>\n<identity display=\"parking\">sip:%s</identity>\n", uuid);
@@ -1191,7 +1191,7 @@
stream.write_function(&stream, "</remote>\n");
} else if (!strcasecmp(proto, "conf")) {
stream.write_function(&stream, "<local>\n<identity display=\"conference\">sip:conference@%s;conference=%s</identity>\n",
- host, !switch_strlen_zero(clean_to_user) ? clean_to_user : "unknown");
+ host, !zstr(clean_to_user) ? clean_to_user : "unknown");
stream.write_function(&stream, "<target uri=\"sip:conference@%s\">\n", host);
stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"yes\"/>\n</target>\n</local>\n");
stream.write_function(&stream, "<remote>\n<identity display=\"conference\">sip:%s@%s</identity>\n", uuid, host);
@@ -1214,7 +1214,7 @@
ct = "application/dialog-info+xml";
}
- if (!switch_strlen_zero(astate) && !switch_strlen_zero(uuid) && helper && helper->stream.data && strcmp(helper->last_uuid, uuid)) {
+ if (!zstr(astate) && !zstr(uuid) && helper && helper->stream.data && strcmp(helper->last_uuid, uuid)) {
helper->stream.write_function(&helper->stream, "update sip_dialogs set state='%s' where uuid='%s';", astate, uuid);
switch_copy_string(helper->last_uuid, uuid, sizeof(helper->last_uuid));
@@ -1231,15 +1231,15 @@
rpid = "on-the-phone";
} else if (!strcmp(astate, "confirmed")) {
char *dest = switch_event_get_header(helper->event, "Caller-Destination-Number");
- if (switch_strlen_zero(from_id) && !switch_strlen_zero(dest)) {
+ if (zstr(from_id) && !zstr(dest)) {
from_id = dest;
}
- if (switch_strlen_zero(from_id)) {
+ if (zstr(from_id)) {
from_id = p_to_user;
}
- if (switch_strlen_zero(from_id)) {
+ if (zstr(from_id)) {
switch_snprintf(status_line, sizeof(status_line), "On The Phone %s", status);
} else {
switch_snprintf(status_line, sizeof(status_line), "Talk %s", switch_str_nil(from_id));
@@ -1450,10 +1450,10 @@
display = contact->m_display;
- if (switch_strlen_zero(display)) {
+ if (zstr(display)) {
if (from) {
display = from->a_display;
- if (switch_strlen_zero(display)) {
+ if (zstr(display)) {
display = "\"user\"";
}
}
@@ -1481,7 +1481,7 @@
int ok = 1;
char *last_acl = NULL;
- if (!switch_strlen_zero(contact_host)) {
+ if (!zstr(contact_host)) {
for (x = 0; x < profile->nat_acl_count; x++) {
last_acl = profile->nat_acl[x];
if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
@@ -1922,12 +1922,12 @@
}
if (!strcasecmp(status_txt, "open")) {
- if (switch_strlen_zero(note_txt)) {
+ if (zstr(note_txt)) {
note_txt = "Available";
}
in = 1;
} else if (!strcasecmp(status_txt, "closed")) {
- if (switch_strlen_zero(note_txt)) {
+ if (zstr(note_txt)) {
note_txt = "Unavailable";
}
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/sofia_reg.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/sofia_reg.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/endpoints/mod_sofia/sofia_reg.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -508,7 +508,7 @@
host = "none";
}
- if (switch_strlen_zero(user)) {
+ if (zstr(user)) {
sqlextra = switch_mprintf(" or (sip_host='%q')", host);
} else {
sqlextra = switch_mprintf(" or (sip_user='%q' and sip_host='%q')", user, host);
@@ -681,8 +681,10 @@
switch_uuid_get(&uuid);
switch_uuid_format(uuid_str, &uuid);
- sql = switch_mprintf("insert into sip_authentication (nonce,expires,profile_name,hostname) "
- "values('%q', %ld, '%q', '%q')", uuid_str, switch_epoch_time_now(NULL) + profile->nonce_ttl, profile->name, mod_sofia_globals.hostname);
+ 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),
+ profile->name, mod_sofia_globals.hostname);
switch_assert(sql != NULL);
sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, profile->ireg_mutex);
switch_safe_free(sql);
@@ -710,6 +712,11 @@
switch_event_t *s_event;
const char *to_user = NULL;
const char *to_host = NULL;
+ char *mwi_account = NULL;
+ char *dup_mwi_account = NULL;
+ char *mwi_user = NULL;
+ char *mwi_host = NULL;
+ char *var = NULL;
const char *from_user = NULL;
const char *from_host = NULL;
const char *reg_host = profile->reg_db_domain;
@@ -817,10 +824,10 @@
}
}
- if (switch_strlen_zero(display)) {
+ if (zstr(display)) {
if (to) {
display = to->a_display;
- if (switch_strlen_zero(display)) {
+ if (zstr(display)) {
display = "\"user\"";
}
}
@@ -986,7 +993,7 @@
if (!authorization || stale) {
const char *realm = profile->challenge_realm;
- if (switch_strlen_zero(realm) || !strcasecmp(realm, "auto_to")) {
+ if (zstr(realm) || !strcasecmp(realm, "auto_to")) {
realm = to_host;
} else if (!strcasecmp(realm, "auto_from")) {
realm = from_host;
@@ -1004,6 +1011,24 @@
}
reg:
+
+ if (v_event && *v_event && (var = switch_event_get_header(*v_event, "sip-force-extension"))) {
+ to_user = var;
+ }
+
+ if (v_event && *v_event && (mwi_account = switch_event_get_header(*v_event, "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);
+ }
+
+ if (!mwi_user) {
+ mwi_user = (char *) to_user;
+ }
+ if (!mwi_host) {
+ mwi_host = (char *) reg_host;
+ }
+
if (regtype != REG_REGISTER) {
switch_goto_int(r, 0, end);
}
@@ -1049,21 +1074,20 @@
}
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) "
- "values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%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) "
+ "values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%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);
+ agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm, mwi_user, mwi_host);
if (sql) {
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
-
switch_mutex_unlock(profile->ireg_mutex);
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_REGISTER) == SWITCH_STATUS_SUCCESS) {
@@ -1198,7 +1222,7 @@
if (sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_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", to_user, reg_host);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", mwi_user, mwi_host);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", profile->name);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "VM-Call-ID", call_id);
}
@@ -1239,6 +1263,7 @@
end:
+ switch_safe_free(dup_mwi_account);
if (auth_params) {
switch_event_destroy(&auth_params);
@@ -1297,7 +1322,7 @@
contact_host = sip->sip_contact->m_url->url_host;
}
- if (!switch_strlen_zero(contact_host)) {
+ if (!zstr(contact_host)) {
for (x = 0; x < profile->nat_acl_count; x++) {
last_acl = profile->nat_acl[x];
if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
@@ -1341,7 +1366,7 @@
sofia_reg_handle_register(nua, profile, nh, sip, type, key, sizeof(key), &v_event, is_nat);
if (v_event) {
- switch_event_fire(&v_event);
+ switch_event_destroy(&v_event);
}
end:
@@ -1544,6 +1569,25 @@
}
+static unsigned long get_nc(const char *nc, sip_t const *sip)
+{
+ unsigned long x;
+ const char *ua = NULL;
+
+ if (sip->sip_user_agent) {
+ ua = sip->sip_user_agent->g_string;
+ }
+
+ /* sigh, polycom sends nc in base-10 rather than spec which says base-16*/
+ if (ua && switch_stristr("polycom", ua)) {
+ x = strtoul(nc, 0, 10);
+ } else {
+ x = strtoul(nc, 0, 16);
+ }
+
+ return x;
+}
+
auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
sip_authorization_t const *authorization,
sip_t const *sip,
@@ -1568,6 +1612,7 @@
int first = 0;
const char *passwd = NULL;
const char *a1_hash = NULL;
+ const char *mwi_account = NULL;
char *sql;
char *number_alias = NULL;
switch_xml_t domain, xml = NULL, user, param, uparams, dparams, group = NULL, gparams = NULL;
@@ -1625,16 +1670,24 @@
/* Optional check that auth name == SIP username */
if ((regtype == REG_REGISTER) && sofia_test_pflag(profile, PFLAG_CHECKUSER)) {
- if (switch_strlen_zero(username) || switch_strlen_zero(to_user) || strcasecmp(to_user, username)) {
+ if (zstr(username) || zstr(to_user) || strcasecmp(to_user, username)) {
/* Names don't match, so fail */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SIP username %s does not match auth username\n", switch_str_nil(to_user));
goto end;
}
}
- if (switch_strlen_zero(np)) {
+ if (zstr(np)) {
first = 1;
- sql = switch_mprintf("select nonce from sip_authentication where nonce='%q'", nonce);
+ if (nc) {
+ unsigned long x;
+
+ x = get_nc(nc, sip);
+ sql = switch_mprintf("select nonce from sip_authentication where nonce='%q' and last_nc + 1 >= %lu", nonce, x);
+ } else {
+ sql = switch_mprintf("select nonce from sip_authentication where nonce='%q'", nonce);
+ }
+
switch_assert(sql != NULL);
if (!sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, np, nplen)) {
free(sql);
@@ -1702,13 +1755,13 @@
}
- if (!switch_strlen_zero(profile->reg_domain)) {
+ if (!zstr(profile->reg_domain)) {
domain_name = profile->reg_domain;
} else {
domain_name = realm;
}
- if (switch_xml_locate_user("id", switch_strlen_zero(username) ? "nobody" : username,
+ 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"
@@ -1727,7 +1780,7 @@
}
if (!(number_alias = (char *) switch_xml_attr(user, "number-alias"))) {
- number_alias = switch_strlen_zero(username) ? "nobody" : username;
+ number_alias = zstr(username) ? "nobody" : username;
}
dparams = switch_xml_child(domain, "params");
@@ -1762,6 +1815,9 @@
if (!strcasecmp(var, "a1-hash")) {
a1_hash = val;
}
+ if (!strcasecmp(var, "mwi-account")) {
+ mwi_account = val;
+ }
}
}
@@ -1786,6 +1842,9 @@
if (!strcasecmp(var, "a1-hash")) {
a1_hash = val;
}
+ if (!strcasecmp(var, "mwi-account")) {
+ mwi_account = val;
+ }
}
}
@@ -1810,6 +1869,9 @@
if (!strcasecmp(var, "a1-hash")) {
a1_hash = val;
}
+ if (!strcasecmp(var, "mwi-account")) {
+ mwi_account = val;
+ }
}
}
@@ -1821,7 +1883,7 @@
}
}
- if (switch_strlen_zero(passwd) && switch_strlen_zero(a1_hash)) {
+ if (zstr(passwd) && zstr(a1_hash)) {
ret = AUTH_OK;
goto skip_auth;
}
@@ -1852,15 +1914,15 @@
input2 = switch_mprintf("%s:%s:%s", a1_hash, nonce, uridigest);
}
- switch_assert(input2);
+ if (input2) {
+ memset(&ctx, 0, sizeof(ctx));
+ su_md5_init(&ctx);
+ su_md5_strupdate(&ctx, input2);
+ su_md5_hexdigest(&ctx, bigdigest);
+ su_md5_deinit(&ctx);
+ }
- memset(&ctx, 0, sizeof(ctx));
- su_md5_init(&ctx);
- su_md5_strupdate(&ctx, input2);
- su_md5_hexdigest(&ctx, bigdigest);
- su_md5_deinit(&ctx);
-
- if (!strcasecmp(bigdigest, response)) {
+ if (input2 && !strcasecmp(bigdigest, response)) {
ret = AUTH_OK;
} else {
if ((profile->ndlb & PFLAG_NDLB_BROKEN_AUTH_HASH) && strcasecmp(regstr, "REGISTER") && strcasecmp(regstr, "INVITE")) {
@@ -1876,6 +1938,7 @@
ret = AUTH_FORBIDDEN;
}
+ switch_safe_free(input2);
skip_auth:
@@ -1897,6 +1960,10 @@
switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "user_name", username);
switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "domain_name", domain_name);
+ if (mwi_account) {
+ switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "mwi-account", mwi_account);
+ }
+
if ((uparams = switch_xml_child(user, "params"))) {
xparams_type[i] = 0;
xparams[i++] = uparams;
@@ -1936,7 +2003,7 @@
const char *val = switch_xml_attr_soft(param, "value");
sofia_gateway_t *gateway_ptr = NULL;
- if (!switch_strlen_zero(var) && !switch_strlen_zero(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);
@@ -1952,7 +2019,7 @@
if ((gateways_tag = switch_xml_child(user, "gateways"))) {
for (gateway_tag = switch_xml_child(gateways_tag, "gateway"); gateway_tag; gateway_tag = gateway_tag->next) {
char *name = (char *) switch_xml_attr_soft(gateway_tag, "name");
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
name = "anonymous";
}
@@ -2010,6 +2077,25 @@
}
end:
+
+ if (nc && cnonce && qop) {
+ unsigned long x;
+ char *sql;
+
+ x = get_nc(nc, sip);
+#if defined(_WIN32) && !defined(_WIN64)
+#define LL_FMT "ll"
+#else
+#define LL_FMT "l"
+#endif
+ 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), x, nonce);
+
+ switch_assert(sql != NULL);
+ sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, profile->ireg_mutex);
+ switch_safe_free(sql);
+ }
+
switch_event_destroy(¶ms);
if (xml) {
@@ -2017,7 +2103,6 @@
}
switch_safe_free(input);
- switch_safe_free(input2);
switch_safe_free(username);
switch_safe_free(realm);
switch_safe_free(nonce);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -372,7 +372,7 @@
}
- if (switch_strlen_zero(globals.default_template)) {
+ if (zstr(globals.default_template)) {
globals.default_template = switch_core_strdup(pool, "default");
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/ei_helpers.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/ei_helpers.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/ei_helpers.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -347,7 +347,7 @@
#endif
memcpy(thishostname, nodehost->h_name, EI_MAXHOSTNAMELEN);
- if (switch_strlen_zero_buf(thishostname)) {
+ if (zstr_buf(thishostname)) {
gethostname(thishostname, EI_MAXHOSTNAMELEN);
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml 2009-11-02 10:10:22 UTC (rev 15314)
@@ -3,10 +3,12 @@
<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"/>-->
+ <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>
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/handle_msg.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/handle_msg.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/handle_msg.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -465,7 +465,7 @@
}
else {
switch_core_session_t *session;
- if (!switch_strlen_zero_buf(uuid) && (session = switch_core_session_locate(uuid))) {
+ if (!zstr_buf(uuid) && (session = switch_core_session_locate(uuid))) {
switch_event_t *event;
if (switch_event_create(&event, SWITCH_EVENT_SEND_MESSAGE) == SWITCH_STATUS_SUCCESS) {
@@ -577,7 +577,7 @@
ei_x_encode_atom(rbuf, "badarg");
} else {
switch_core_session_t *session;
- if (!switch_strlen_zero_buf(uuid_str)) {
+ 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)) ||
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -451,7 +451,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got data %s after %d milliseconds!\n", xmlstr, i*10);
- if (switch_strlen_zero(xmlstr)) {
+ if (zstr(xmlstr)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
} else if (!(xml = switch_xml_parse_str_dynamic(xmlstr, SWITCH_FALSE))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
@@ -848,7 +848,7 @@
static switch_bool_t check_inbound_acl(listener_t* listener)
{
/* check acl to see if inbound connection is allowed */
- if (prefs.acl_count && !switch_strlen_zero(listener->remote_ip)) {
+ if (prefs.acl_count && !zstr(listener->remote_ip)) {
uint32_t x = 0;
for (x = 0; x < prefs.acl_count; x++) {
if (!switch_check_network_list_ip(listener->remote_ip, prefs.acl[x])) {
@@ -904,7 +904,7 @@
switch_assert(listener != NULL);
if (check_inbound_acl(listener)) {
- if (switch_strlen_zero(listener->remote_ip)) {
+ 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);*/
@@ -982,6 +982,7 @@
prefs.shortname = SWITCH_TRUE;
prefs.encoding = ERLANG_STRING;
+ prefs.compat_rel = 0;
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
@@ -999,6 +1000,11 @@
set_pref_cookie(val);
} else if (!strcmp(var, "nodename")) {
set_pref_nodename(val);
+ } else if (!strcmp(var, "compat-rel")) {
+ if (atoi(val) >= 7)
+ prefs.compat_rel = atoi(val);
+ 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);
} else if (!strcmp(var, "encoding")) {
@@ -1021,11 +1027,11 @@
switch_xml_free(xml);
}
- if (switch_strlen_zero(prefs.ip)) {
+ if (zstr(prefs.ip)) {
set_pref_ip("0.0.0.0");
}
- if (switch_strlen_zero(prefs.cookie)) {
+ if (zstr(prefs.cookie)) {
set_pref_cookie("ClueCon");
}
@@ -1313,7 +1319,7 @@
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error - need registered name and node!\n");
return;
}
- if (switch_strlen_zero(argv[0])) {
+ if (zstr(argv[0])) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing registered name or module:function!\n");
return;
}
@@ -1333,7 +1339,7 @@
node = argv[1];
- if (switch_strlen_zero(node)) {
+ if (zstr(node)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing node name!\n");
return;
}
@@ -1445,7 +1451,7 @@
"erlang sessions <node_name>\n"
"--------------------------------------------------------------------------------\n";
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
@@ -1650,6 +1656,11 @@
switch_yield(100000);
}
+ if (prefs.compat_rel) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Compatability with OTP R%d requested\n", prefs.compat_rel);
+ ei_set_compat_rel(prefs.compat_rel);
+ }
+
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;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h 2009-11-02 10:10:22 UTC (rev 15314)
@@ -181,6 +181,7 @@
uint32_t acl_count;
uint32_t id;
erlang_encoding_t encoding;
+ int compat_rel;
};
typedef struct prefs_struct prefs_t;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_event_socket/mod_event_socket.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_event_socket/mod_event_socket.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -356,7 +356,7 @@
host = argv[0];
- if (switch_strlen_zero(host)) {
+ if (zstr(host)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing Host!\n");
return;
}
@@ -432,9 +432,7 @@
switch_ivr_park(session, NULL);
- if (switch_core_session_private_event_count(session)) {
- switch_ivr_parse_all_events(session);
- }
+ 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);
@@ -585,7 +583,7 @@
}
if (!http) {
- stream->write_function(stream, "This is a web application.!\n");
+ stream->write_function(stream, "This is a web application!\n");
return SWITCH_STATUS_SUCCESS;
}
stream->write_function(stream, "Content-Type: text/xml\n\n");
@@ -619,7 +617,7 @@
goto end;
}
- if (switch_strlen_zero(action)) {
+ if (zstr(action)) {
stream->write_function(stream, "<data><reply type=\"error\">Invalid Syntax</reply></data>\n");
goto end;
}
@@ -630,7 +628,7 @@
}
if (!strcasecmp(action, "delete")) {
- if (switch_strlen_zero(header_val)) {
+ if (zstr(header_val)) {
stream->write_function(stream, "<data><reply type=\"error\">Invalid Syntax</reply></data>\n");
goto filter_end;
}
@@ -643,7 +641,7 @@
}
stream->write_function(stream, "<data>\n <reply type=\"success\">filter deleted.</reply>\n<api-command>\n");
} else if (!strcasecmp(action, "add")) {
- if (switch_strlen_zero(header_name) || switch_strlen_zero(header_val)) {
+ if (zstr(header_name) || zstr(header_val)) {
stream->write_function(stream, "<data><reply type=\"error\">Invalid Syntax</reply></data>\n");
goto filter_end;
}
@@ -717,7 +715,7 @@
uint8_t custom = 0;
char *edup;
- if (switch_strlen_zero(events) && switch_strlen_zero(loglevel)) {
+ if (zstr(events) && zstr(loglevel)) {
stream->write_function(stream, "<data><reply type=\"error\">Missing parameter!</reply></data>\n");
goto end;
}
@@ -1070,7 +1068,7 @@
char *var, *val;
var = cur;
strip_cr(var);
- if (!switch_strlen_zero(var)) {
+ if (!zstr(var)) {
if ((val = strchr(var, ':'))) {
*val++ = '\0';
while (*val == ' ') {
@@ -1537,6 +1535,7 @@
listener->event_list[SWITCH_EVENT_CHANNEL_EXECUTE] = 1;
listener->event_list[SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE] = 1;
listener->event_list[SWITCH_EVENT_CHANNEL_HANGUP] = 1;
+ listener->event_list[SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE] = 1;
listener->event_list[SWITCH_EVENT_CHANNEL_ORIGINATE] = 1;
listener->event_list[SWITCH_EVENT_CHANNEL_UUID] = 1;
listener->event_list[SWITCH_EVENT_CHANNEL_OUTGOING] = 1;
@@ -1584,7 +1583,7 @@
}
}
- if (switch_strlen_zero(onoff)) {
+ if (zstr(onoff)) {
switch_snprintf(reply, reply_len, "-ERR missing value.");
goto done;
}
@@ -1624,7 +1623,7 @@
}
}
- if (switch_strlen_zero(uuid)) {
+ if (zstr(uuid)) {
uuid = switch_event_get_header(*event, "session-id");
}
@@ -1632,7 +1631,7 @@
uuid = NULL;
}
- if (switch_strlen_zero(uuid) && listener->session) {
+ if (zstr(uuid) && listener->session) {
if (async) {
if ((status = switch_core_session_queue_private_event(listener->session, event)) == SWITCH_STATUS_SUCCESS) {
switch_snprintf(reply, reply_len, "+OK");
@@ -1644,7 +1643,7 @@
switch_snprintf(reply, reply_len, "+OK");
}
} else {
- if (!switch_strlen_zero(uuid) && (session = switch_core_session_locate(uuid))) {
+ if (!zstr(uuid) && (session = switch_core_session_locate(uuid))) {
if ((status = switch_core_session_queue_private_event(session, event)) == SWITCH_STATUS_SUCCESS) {
switch_snprintf(reply, reply_len, "+OK");
} else {
@@ -1790,12 +1789,12 @@
level_s = cmd + 3;
//see if we got an argument
- if (!switch_strlen_zero(level_s)) {
+ if (!zstr(level_s)) {
//if so move to the argument
level_s++;
}
//see if we lined up on an argument or not
- if (!switch_strlen_zero(level_s)) {
+ if (!zstr(level_s)) {
ltype = switch_log_str2level(level_s);
}
@@ -1962,7 +1961,7 @@
done:
- if (switch_strlen_zero(reply)) {
+ if (zstr(reply)) {
switch_snprintf(reply, reply_len, "-ERR command not found");
}
@@ -2004,7 +2003,7 @@
switch_socket_opt_set(listener->sock, SWITCH_SO_TCP_NODELAY, TRUE);
switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE);
- if (prefs.acl_count && listener->sa && !switch_strlen_zero(listener->remote_ip)) {
+ if (prefs.acl_count && listener->sa && !zstr(listener->remote_ip)) {
uint32_t x = 0;
for (x = 0; x < prefs.acl_count; x++) {
@@ -2025,7 +2024,7 @@
}
if (globals.debug > 0) {
- if (switch_strlen_zero(listener->remote_ip)) {
+ 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);
@@ -2244,11 +2243,11 @@
switch_xml_free(xml);
}
- if (switch_strlen_zero(prefs.ip)) {
+ if (zstr(prefs.ip)) {
set_pref_ip("127.0.0.1");
}
- if (switch_strlen_zero(prefs.password)) {
+ if (zstr(prefs.password)) {
set_pref_pass("ClueCon");
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -138,6 +138,7 @@
switch_status_t retval = SWITCH_STATUS_TERM;
VALUE_PAIR *send = NULL;
uint32_t client_port = 0;
+ uint32_t framed_addr = 0;
uint32_t status_type = PW_STATUS_START;
switch_time_t callstartdate = 0;
switch_time_t callanswerdate = 0;
@@ -254,7 +255,9 @@
}
}
if (profile->network_addr) {
- if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *) profile->network_addr, -1, 0) == NULL) {
+ inet_pton(AF_INET, (void *) profile->network_addr, &framed_addr);
+ framed_addr = htonl(framed_addr);
+ if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, &framed_addr, -1, 0) == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Framed-IP-Address: %s\n", profile->network_addr);
rc_destroy(rad_config);
goto end;
@@ -366,7 +369,9 @@
retval = SWITCH_STATUS_TERM;
}
rc_avpair_free(send);
+ rc_destroy(rad_config);
end:
+ switch_xml_free(cdr);
switch_thread_rwlock_unlock(globals.rwlock);
return (retval);
}
@@ -379,6 +384,7 @@
switch_status_t retval = SWITCH_STATUS_TERM;
VALUE_PAIR *send = NULL;
uint32_t client_port = 0;
+ uint32_t framed_addr = 0;
uint32_t status_type = PW_STATUS_STOP;
switch_time_t callstartdate = 0;
switch_time_t callanswerdate = 0;
@@ -513,7 +519,9 @@
}
}
if (profile->network_addr) {
- if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *) profile->network_addr, -1, 0) == NULL) {
+ inet_pton(AF_INET, (void *) profile->network_addr, &framed_addr);
+ framed_addr = htonl(framed_addr);
+ if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, &framed_addr, -1, 0) == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Framed-IP-Address: %s\n", profile->network_addr);
rc_destroy(rad_config);
goto end;
@@ -635,8 +643,10 @@
retval = SWITCH_STATUS_TERM;
}
rc_avpair_free(send);
+ rc_destroy(rad_config);
end:
+ switch_xml_free(cdr);
switch_thread_rwlock_unlock(globals.rwlock);
return (retval);
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/formats/mod_local_stream/mod_local_stream.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/formats/mod_local_stream/mod_local_stream.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/formats/mod_local_stream/mod_local_stream.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -608,7 +608,7 @@
int argc = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
@@ -621,7 +621,7 @@
}
local_stream_name = argv[0];
- if (switch_strlen_zero(local_stream_name)) {
+ if (zstr(local_stream_name)) {
goto usage;
}
@@ -662,7 +662,7 @@
switch_mutex_lock(globals.mutex);
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
for (hi = switch_hash_first(NULL, globals.source_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &var, NULL, &val);
if ((source = (local_stream_source_t *) val)) {
@@ -751,7 +751,7 @@
switch_xml_t cfg, xml, directory, param;
int tmp;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
@@ -855,7 +855,7 @@
switch_xml_free(xml);
}
- if (switch_strlen_zero(local_stream_name) || switch_strlen_zero(path)) {
+ if (zstr(local_stream_name) || zstr(path)) {
goto usage;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/formats/mod_native_file/mod_native_file.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/formats/mod_native_file/mod_native_file.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/formats/mod_native_file/mod_native_file.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -152,7 +152,7 @@
uint32_t x;
for (x = 0; x < num_codecs; x++) {
- supported_formats[x] = codecs[x]->iananame;
+ supported_formats[x] = switch_core_strdup(pool, codecs[x]->iananame);
}
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -136,7 +136,7 @@
int match = 0;
pdi = Pa_GetDeviceInfo(i);
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
match = 1;
} else if (pdi && pdi->name && strstr(pdi->name, name)) {
match = 1;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java 2009-11-02 10:10:22 UTC (rev 15314)
@@ -193,10 +193,6 @@
return freeswitchJNI.CoreSession_recordFile__SWIG_3(swigCPtr, this, file_name);
}
- public void setCallerData(String var, String val) {
- freeswitchJNI.CoreSession_setCallerData(swigCPtr, this, var, val);
- }
-
public int originate(CoreSession a_leg_session, String dest, int timeout, SWIGTYPE_p_switch_state_handler_table_t handlers) {
return freeswitchJNI.CoreSession_originate__SWIG_0(swigCPtr, this, CoreSession.getCPtr(a_leg_session), a_leg_session, dest, timeout, SWIGTYPE_p_switch_state_handler_table_t.getCPtr(handlers));
}
@@ -225,10 +221,14 @@
freeswitchJNI.CoreSession_set_tts_parms(swigCPtr, this, tts_name, voice_name);
}
- public int collectDigits(int timeout) {
- return freeswitchJNI.CoreSession_collectDigits(swigCPtr, this, timeout);
+ public int collectDigits(int abs_timeout) {
+ return freeswitchJNI.CoreSession_collectDigits__SWIG_0(swigCPtr, this, abs_timeout);
}
+ public int collectDigits(int digit_timeout, int abs_timeout) {
+ return freeswitchJNI.CoreSession_collectDigits__SWIG_1(swigCPtr, this, digit_timeout, abs_timeout);
+ }
+
public String getDigits(int maxdigits, String terminators, int timeout) {
return freeswitchJNI.CoreSession_getDigits__SWIG_0(swigCPtr, this, maxdigits, terminators, timeout);
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java 2009-11-02 10:10:22 UTC (rev 15314)
@@ -125,7 +125,6 @@
public final static native int CoreSession_recordFile__SWIG_1(long jarg1, CoreSession jarg1_, String jarg2, int jarg3, int jarg4);
public final static native int CoreSession_recordFile__SWIG_2(long jarg1, CoreSession jarg1_, String jarg2, int jarg3);
public final static native int CoreSession_recordFile__SWIG_3(long jarg1, CoreSession jarg1_, String jarg2);
- public final static native void CoreSession_setCallerData(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
public final static native int CoreSession_originate__SWIG_0(long jarg1, CoreSession jarg1_, long jarg2, CoreSession jarg2_, String jarg3, int jarg4, long jarg5);
public final static native int CoreSession_originate__SWIG_1(long jarg1, CoreSession jarg1_, long jarg2, CoreSession jarg2_, String jarg3, int jarg4);
public final static native int CoreSession_originate__SWIG_2(long jarg1, CoreSession jarg1_, long jarg2, CoreSession jarg2_, String jarg3);
@@ -133,7 +132,8 @@
public final static native void CoreSession_setDTMFCallback(long jarg1, CoreSession jarg1_, long jarg2, String jarg3);
public final static native int CoreSession_speak(long jarg1, CoreSession jarg1_, String jarg2);
public final static native void CoreSession_set_tts_parms(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
- public final static native int CoreSession_collectDigits(long jarg1, CoreSession jarg1_, int jarg2);
+ public final static native int CoreSession_collectDigits__SWIG_0(long jarg1, CoreSession jarg1_, int jarg2);
+ public final static native int CoreSession_collectDigits__SWIG_1(long jarg1, CoreSession jarg1_, int jarg2, int jarg3);
public final static native String CoreSession_getDigits__SWIG_0(long jarg1, CoreSession jarg1_, int jarg2, String jarg3, int jarg4);
public final static native String CoreSession_getDigits__SWIG_1(long jarg1, CoreSession jarg1_, int jarg2, String jarg3, int jarg4, int jarg5);
public final static native int CoreSession_transfer__SWIG_0(long jarg1, CoreSession jarg1_, String jarg2, String jarg3, String jarg4);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_java/switch_swig_wrap.cpp (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_java/switch_swig_wrap.cpp 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_java/switch_swig_wrap.cpp 2009-11-02 10:10:22 UTC (rev 15314)
@@ -2345,31 +2345,6 @@
}
-SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1setCallerData(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
-
- (void)jenv;
- (void)jcls;
- (void)jarg1_;
- arg1 = *(CoreSession **)&jarg1;
- arg2 = 0;
- if (jarg2) {
- arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
- if (!arg2) return ;
- }
- arg3 = 0;
- if (jarg3) {
- arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
- if (!arg3) return ;
- }
- (arg1)->setCallerData(arg2,arg3);
- if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
- if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
-}
-
-
SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1originate_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3, jint jarg4, jlong jarg5) {
jint jresult = 0 ;
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -2529,7 +2504,7 @@
}
-SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1collectDigits(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1collectDigits_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
jint jresult = 0 ;
CoreSession *arg1 = (CoreSession *) 0 ;
int arg2 ;
@@ -2546,6 +2521,25 @@
}
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1collectDigits_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int arg2 ;
+ int arg3 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = (int)jarg2;
+ arg3 = (int)jarg3;
+ result = (int)(arg1)->collectDigits(arg2,arg3);
+ jresult = (jint)result;
+ return jresult;
+}
+
+
SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1getDigits_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3, jint jarg4) {
jstring jresult = 0 ;
CoreSession *arg1 = (CoreSession *) 0 ;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_lua/freeswitch_lua.cpp (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_lua/freeswitch_lua.cpp 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_lua/freeswitch_lua.cpp 2009-11-02 10:10:22 UTC (rev 15314)
@@ -140,7 +140,7 @@
lua_call(L, arg_count, 1);
err = lua_tostring(L, -1);
- if (!switch_strlen_zero(err)) {
+ if (!zstr(err)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
}
@@ -198,7 +198,7 @@
if (func) {
hangup_func_str = strdup(func);
- if (!switch_strlen_zero(arg)) {
+ if (!zstr(arg)) {
hangup_func_arg = strdup(arg);
}
switch_channel_set_private(channel, "CoreSession", this);
@@ -269,7 +269,7 @@
lua_pushnumber(L, dtmf->duration);
lua_rawset(L, -3);
- if (!switch_strlen_zero(cb_arg)) {
+ if (!zstr(cb_arg)) {
lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_arg);
arg_count++;
}
@@ -293,7 +293,7 @@
mod_lua_conjure_event(L, event, "__Input_Event__", 1);
lua_getfield(L, LUA_GLOBALSINDEX, "__Input_Event__");
- if (!switch_strlen_zero(cb_arg)) {
+ if (!zstr(cb_arg)) {
lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_arg);
arg_count++;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_lua/mod_lua.cpp (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_lua/mod_lua.cpp 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_lua/mod_lua.cpp 2009-11-02 10:10:22 UTC (rev 15314)
@@ -121,7 +121,7 @@
{
int error = 0;
- if (switch_strlen_zero(input_code)) {
+ if (zstr(input_code)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No code to execute!\n");
return 1;
}
@@ -178,7 +178,7 @@
if (error) {
const char *err = lua_tostring(L, -1);
- if (!switch_strlen_zero(err)) {
+ if (!zstr(err)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
}
lua_pop(L, 1); /* pop error message from the stack */
@@ -216,7 +216,7 @@
switch_xml_t xml = NULL;
- if (!switch_strlen_zero(globals.xml_handler)) {
+ if (!zstr(globals.xml_handler)) {
lua_State *L = lua_init();
char *mycmd = strdup(globals.xml_handler);
const char *str;
@@ -253,7 +253,7 @@
str = lua_tostring(L, 1);
if (str) {
- if (switch_strlen_zero(str)) {
+ if (zstr(str)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
} else if (!(xml = switch_xml_parse_str_dynamic((char *)str, SWITCH_TRUE))) {
/* const char -> char conversion was OK because switch_xml_parse_str_dynamic makes a duplicate of str
@@ -293,17 +293,17 @@
if (!strcmp(var, "xml-handler-script")) {
globals.xml_handler = switch_core_strdup(globals.pool, val);
} else if (!strcmp(var, "xml-handler-bindings")) {
- if (!switch_strlen_zero(globals.xml_handler)) {
+ if (!zstr(globals.xml_handler)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, val);
switch_xml_bind_search_function(lua_fetch, switch_xml_parse_section_string(val), NULL);
}
- } else if (!strcmp(var, "module-directory") && !switch_strlen_zero(val)) {
+ } else if (!strcmp(var, "module-directory") && !zstr(val)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "lua: appending module directory: '%s'\n", val);
if (cpath_stream.data_len) {
cpath_stream.write_function(&cpath_stream, ";");
}
cpath_stream.write_function(&cpath_stream, "%s", val);
- } else if (!strcmp(var, "script-directory") && !switch_strlen_zero(val)) {
+ } else if (!strcmp(var, "script-directory") && !zstr(val)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "lua: appending script directory: '%s'\n", val);
if (path_stream.data_len) {
path_stream.write_function(&path_stream, ";");
@@ -394,7 +394,7 @@
char *mycmd;
int error;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no args specified!\n");
return;
}
@@ -413,7 +413,7 @@
SWITCH_STANDARD_API(luarun_api_function)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-ERR no args specified!\n");
} else {
lua_thread(cmd);
@@ -431,7 +431,7 @@
char *mycmd;
int error;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "");
} else {
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_lua/mod_lua_wrap.cpp (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_lua/mod_lua_wrap.cpp 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_lua/mod_lua_wrap.cpp 2009-11-02 10:10:22 UTC (rev 15314)
@@ -5459,36 +5459,6 @@
}
-static int _wrap_CoreSession_setCallerData(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
-
- SWIG_check_num_args("setCallerData",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setCallerData",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("setCallerData",2,"char *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("setCallerData",3,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_setCallerData",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- (arg1)->setCallerData(arg2,arg3);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
-
-
static int _wrap_CoreSession_originate__SWIG_0(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -5839,7 +5809,7 @@
}
-static int _wrap_CoreSession_collectDigits(lua_State* L) {
+static int _wrap_CoreSession_collectDigits__SWIG_0(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
int arg2 ;
@@ -5867,6 +5837,93 @@
}
+static int _wrap_CoreSession_collectDigits__SWIG_1(lua_State* L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int arg2 ;
+ int arg3 ;
+ int result;
+
+ SWIG_check_num_args("collectDigits",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("collectDigits",1,"CoreSession *");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("collectDigits",2,"int");
+ if(!lua_isnumber(L,3)) SWIG_fail_arg("collectDigits",3,"int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+ SWIG_fail_ptr("CoreSession_collectDigits",1,SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (int)lua_tonumber(L, 2);
+ arg3 = (int)lua_tonumber(L, 3);
+ result = (int)(arg1)->collectDigits(arg2,arg3);
+ SWIG_arg=0;
+ lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_CoreSession_collectDigits(lua_State* L) {
+ int argc;
+ int argv[4]={
+ 1,2,3,4
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L,argv[1]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_collectDigits__SWIG_0(L);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L,argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L,argv[2]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_collectDigits__SWIG_1(L);
+ }
+ }
+ }
+ }
+
+ lua_pushstring(L,"No matching function for overloaded 'CoreSession_collectDigits'");
+ lua_error(L);return 0;
+}
+
+
static int _wrap_CoreSession_getDigits__SWIG_0(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -7285,7 +7342,6 @@
{"hangupCause", _wrap_CoreSession_hangupCause},
{"getState", _wrap_CoreSession_getState},
{"recordFile", _wrap_CoreSession_recordFile},
- {"setCallerData", _wrap_CoreSession_setCallerData},
{"originate", _wrap_CoreSession_originate},
{"destroy", _wrap_CoreSession_destroy},
{"setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_managed/freeswitch_wrap.cxx (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_managed/freeswitch_wrap.cxx 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_managed/freeswitch_wrap.cxx 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1114,6 +1114,17 @@
}
+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 ;
@@ -4706,6 +4717,17 @@
}
+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 ;
@@ -5130,6 +5152,32 @@
}
+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_new_switch_core_session_message() {
void * jresult ;
switch_core_session_message *result = 0 ;
@@ -6150,6 +6198,14 @@
}
+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 ;
@@ -6306,6 +6362,14 @@
}
+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 ;
@@ -9451,13 +9515,15 @@
}
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_simple_email(char * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5) {
+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;
@@ -9465,7 +9531,9 @@
arg3 = (char *)jarg3;
arg4 = (char *)jarg4;
arg5 = (char *)jarg5;
- result = (switch_bool_t)switch_simple_email((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
+ 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;
}
@@ -9717,6 +9785,64 @@
}
+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 ;
@@ -19417,6 +19543,30 @@
}
+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 ;
@@ -19473,6 +19623,40 @@
}
+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 ;
@@ -22104,6 +22288,18 @@
}
+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 ;
@@ -22664,6 +22860,16 @@
}
+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 ;
@@ -23472,6 +23678,18 @@
}
+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;
@@ -28848,18 +29066,6 @@
}
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_SetCallerData(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)->setCallerData(arg2,arg3);
-}
-
-
SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_originate(void * jarg1, void * jarg2, char * jarg3, int jarg4, void * jarg5) {
int jresult ;
CoreSession *arg1 = (CoreSession *) 0 ;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.dll
(Binary files differ)
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.pdb
(Binary files differ)
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_managed/managed/swig.cs (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_managed/managed/swig.cs 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_managed/managed/swig.cs 2009-11-02 10:10:22 UTC (rev 15314)
@@ -260,10 +260,6 @@
return ret;
}
- public void SetCallerData(string var, string val) {
- freeswitchPINVOKE.CoreSession_SetCallerData(swigCPtr, var, val);
- }
-
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;
@@ -1203,6 +1199,10 @@
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));
}
@@ -1269,6 +1269,10 @@
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;
@@ -2373,8 +2377,8 @@
return ret;
}
- public static switch_bool_t switch_simple_email(string to, string from, string headers, string body, string file) {
- switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_simple_email(to, from, headers, body, file);
+ 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;
}
@@ -2626,6 +2630,15 @@
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));
}
@@ -2649,6 +2662,19 @@
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;
@@ -3173,6 +3199,11 @@
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;
@@ -3328,6 +3359,10 @@
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;
@@ -3575,6 +3610,11 @@
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();
@@ -4365,6 +4405,7 @@
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();
@@ -4456,6 +4497,7 @@
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 string SWITCH_CORE_DB = freeswitchPINVOKE.SWITCH_CORE_DB_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();
@@ -4880,6 +4922,9 @@
[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();
@@ -5771,6 +5816,9 @@
[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);
@@ -5867,6 +5915,12 @@
[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_new_switch_core_session_message")]
public static extern IntPtr new_switch_core_session_message();
@@ -6107,6 +6161,9 @@
[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);
@@ -6149,6 +6206,9 @@
[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);
@@ -6825,7 +6885,7 @@
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);
+ 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);
@@ -6875,6 +6935,18 @@
[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);
@@ -9293,6 +9365,12 @@
[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);
@@ -9308,6 +9386,15 @@
[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);
@@ -9899,6 +9986,9 @@
[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);
@@ -9992,6 +10082,9 @@
[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);
+ [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);
@@ -10139,6 +10232,9 @@
[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();
@@ -11420,9 +11516,6 @@
[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_SetCallerData")]
- public static extern void CoreSession_SetCallerData(HandleRef jarg1, string jarg2, string jarg3);
-
[DllImport("mod_managed", EntryPoint="CSharp_CoreSession_originate")]
public static extern int CoreSession_originate(HandleRef jarg1, HandleRef jarg2, string jarg3, int jarg4, HandleRef jarg5);
@@ -17680,6 +17773,26 @@
}
}
+ 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);
@@ -17996,11 +18109,27 @@
namespace FreeSWITCH.Native {
+public enum switch_channel_cap_t {
+ CC_MEDIA_ACK = 1,
+ 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_ORIGINATOR,
+ CF_BRIDGE_ORIGINATOR,
CF_TRANSFER,
CF_ACCEPT_CNG,
CF_REDIRECT,
@@ -18034,6 +18163,9 @@
CF_REPORTING,
CF_PARK,
CF_TIMESTAMP_SET,
+ CF_ORIGINATOR,
+ CF_XFER_ZOMBIE,
+ CF_MEDIA_ACK,
CF_FLAG_MAX
}
@@ -19486,6 +19618,17 @@
}
}
+ 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 switch_core_session_message() : this(freeswitchPINVOKE.new_switch_core_session_message(), true) {
}
@@ -20914,6 +21057,7 @@
SWITCH_EVENT_NAT,
SWITCH_EVENT_RECORD_START,
SWITCH_EVENT_RECORD_STOP,
+ SWITCH_EVENT_CALL_UPDATE,
SWITCH_EVENT_ALL
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_managed/mod_managed.cpp (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_managed/mod_managed.cpp 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_managed/mod_managed.cpp 2009-11-02 10:10:22 UTC (rev 15314)
@@ -371,7 +371,7 @@
#endif
SWITCH_STANDARD_API(managedrun_api_function)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-ERR no args specified!\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -391,7 +391,7 @@
SWITCH_STANDARD_API(managed_api_function)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-ERR no args specified!\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -409,7 +409,7 @@
SWITCH_STANDARD_APP(managed_app_function)
{
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n");
return;
}
@@ -426,7 +426,7 @@
SWITCH_STANDARD_API(managedreload_api_function)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-ERR no args specified!\n");
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_perl/freeswitch.pm (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_perl/freeswitch.pm 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_perl/freeswitch.pm 2009-11-02 10:10:22 UTC (rev 15314)
@@ -414,7 +414,6 @@
*hangupCause = *freeswitchc::CoreSession_hangupCause;
*getState = *freeswitchc::CoreSession_getState;
*recordFile = *freeswitchc::CoreSession_recordFile;
-*setCallerData = *freeswitchc::CoreSession_setCallerData;
*originate = *freeswitchc::CoreSession_originate;
*destroy = *freeswitchc::CoreSession_destroy;
*setDTMFCallback = *freeswitchc::CoreSession_setDTMFCallback;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_perl/mod_perl.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_perl/mod_perl.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_perl/mod_perl.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -64,7 +64,7 @@
Perl_eval_pv(my_perl, string, FALSE);
- if ((err = SvPV(get_sv("@", TRUE), n_a)) && !switch_strlen_zero(err)) {
+ if ((err = SvPV(get_sv("@", TRUE), n_a)) && !zstr(err)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[%s]\n%s\n", string, err);
return -1;
}
@@ -77,7 +77,7 @@
{
int error = 0;
- if (switch_strlen_zero(input_code)) {
+ if (zstr(input_code)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No code to execute!\n");
return -1;
}
@@ -183,7 +183,7 @@
}
}
- if ((err = SvPV(get_sv("@", TRUE), n_a)) && !switch_strlen_zero(err)) {
+ if ((err = SvPV(get_sv("@", TRUE), n_a)) && !zstr(err)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
}
@@ -304,7 +304,7 @@
SWITCH_STANDARD_API(perlrun_api_function)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-ERR Missing args.\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -319,7 +319,7 @@
struct perl_o po = { 0 };
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-ERR Missing args.\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -338,7 +338,7 @@
int argc = 0;
switch_xml_t xml = NULL;
- if (!switch_strlen_zero(globals.xml_handler)) {
+ if (!zstr(globals.xml_handler)) {
PerlInterpreter *my_perl = clone_perl();
HV *hash;
char *str;
@@ -360,7 +360,7 @@
abort();
}
- if (switch_strlen_zero(section)) {
+ if (zstr(section)) {
section = "";
}
@@ -368,7 +368,7 @@
sv_setpv(this, section);
hv_store(hash, "section", 7, this, 0);
- if (switch_strlen_zero(tag_name)) {
+ if (zstr(tag_name)) {
tag_name = "";
}
@@ -376,7 +376,7 @@
sv_setpv(this, tag_name);
hv_store(hash, "tag_name", 8, this, 0);
- if (switch_strlen_zero(key_name)) {
+ if (zstr(key_name)) {
key_name = "";
}
@@ -384,7 +384,7 @@
sv_setpv(this, key_name);
hv_store(hash, "key_name", 8, this, 0);
- if (switch_strlen_zero(key_value)) {
+ if (zstr(key_value)) {
key_value = "";
}
@@ -414,8 +414,8 @@
perl_run(my_perl);
str = SvPV(get_sv("XML_STRING", TRUE), n_a);
- if (!switch_strlen_zero(str)) {
- if (switch_strlen_zero(str)) {
+ if (!zstr(str)) {
+ if (zstr(str)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
} else if (!(xml = switch_xml_parse_str(str, strlen(str)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
@@ -446,7 +446,7 @@
if (!strcmp(var, "xml-handler-script")) {
globals.xml_handler = switch_core_strdup(globals.pool, val);
} else if (!strcmp(var, "xml-handler-bindings")) {
- if (!switch_strlen_zero(globals.xml_handler)) {
+ if (!zstr(globals.xml_handler)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, var);
switch_xml_bind_search_function(perl_fetch, switch_xml_parse_section_string(val), NULL);
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_perl/mod_perl_wrap.cpp (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_perl/mod_perl_wrap.cpp 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_perl/mod_perl_wrap.cpp 2009-11-02 10:10:22 UTC (rev 15314)
@@ -7080,55 +7080,6 @@
}
-XS(_wrap_CoreSession_setCallerData) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 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: CoreSession_setCallerData(self,var,val);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2"" of type '" "char *""'");
- }
- 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 '" "CoreSession_setCallerData" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->setCallerData(arg2,arg3);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
-
-
XS(_wrap_CoreSession_originate__SWIG_0) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -7632,7 +7583,7 @@
}
-XS(_wrap_CoreSession_collectDigits) {
+XS(_wrap_CoreSession_collectDigits__SWIG_0) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
int arg2 ;
@@ -7645,7 +7596,7 @@
dXSARGS;
if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_collectDigits(self,timeout);");
+ SWIG_croak("Usage: CoreSession_collectDigits(self,abs_timeout);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
@@ -7670,6 +7621,146 @@
}
+XS(_wrap_CoreSession_collectDigits__SWIG_1) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int arg2 ;
+ int arg3 ;
+ int result;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int val2 ;
+ int ecode2 = 0 ;
+ int val3 ;
+ int ecode3 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_collectDigits(self,digit_timeout,abs_timeout);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2"" of type '" "int""'");
+ }
+ arg2 = static_cast< int >(val2);
+ ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_collectDigits" "', argument " "3"" of type '" "int""'");
+ }
+ arg3 = static_cast< int >(val3);
+ result = (int)(arg1)->collectDigits(arg2,arg3);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_CoreSession_collectDigits) {
+ dXSARGS;
+
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_1;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ {
+ int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+ _v = SWIG_CheckState(res);
+ }
+ }
+ if (!_v) goto check_1;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki; _index = 1;
+ if (_rank == _rankm) goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 3) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_2;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ {
+ int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+ _v = SWIG_CheckState(res);
+ }
+ }
+ if (!_v) goto check_2;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ {
+ int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+ _v = SWIG_CheckState(res);
+ }
+ }
+ if (!_v) goto check_2;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki; _index = 2;
+ if (_rank == _rankm) goto dispatch;
+ }
+ }
+ check_2:
+
+ dispatch:
+ switch(_index) {
+ case 1:
+ ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_collectDigits__SWIG_0); return;
+ case 2:
+ ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_collectDigits__SWIG_1); return;
+ }
+ }
+
+ croak("No matching function for overloaded 'CoreSession_collectDigits'");
+ XSRETURN(0);
+}
+
+
XS(_wrap_CoreSession_getDigits__SWIG_0) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -11598,7 +11689,6 @@
{"freeswitchc::CoreSession_hangupCause", _wrap_CoreSession_hangupCause},
{"freeswitchc::CoreSession_getState", _wrap_CoreSession_getState},
{"freeswitchc::CoreSession_recordFile", _wrap_CoreSession_recordFile},
-{"freeswitchc::CoreSession_setCallerData", _wrap_CoreSession_setCallerData},
{"freeswitchc::CoreSession_originate", _wrap_CoreSession_originate},
{"freeswitchc::CoreSession_destroy", _wrap_CoreSession_destroy},
{"freeswitchc::CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_python/freeswitch.py (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_python/freeswitch.py 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_python/freeswitch.py 2009-11-02 10:10:22 UTC (rev 15314)
@@ -272,7 +272,6 @@
def hangupCause(*args): return _freeswitch.CoreSession_hangupCause(*args)
def getState(*args): return _freeswitch.CoreSession_getState(*args)
def recordFile(*args): return _freeswitch.CoreSession_recordFile(*args)
- def setCallerData(*args): return _freeswitch.CoreSession_setCallerData(*args)
def originate(*args): return _freeswitch.CoreSession_originate(*args)
def destroy(*args): return _freeswitch.CoreSession_destroy(*args)
def setDTMFCallback(*args): return _freeswitch.CoreSession_setDTMFCallback(*args)
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_python/mod_python.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_python/mod_python.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_python/mod_python.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -236,7 +236,7 @@
switch_xml_t xml = NULL;
char *str = NULL;
- if (!switch_strlen_zero(globals.xml_handler)) {
+ if (!zstr(globals.xml_handler)) {
char *mycmd = strdup(globals.xml_handler);
switch_assert(mycmd);
@@ -244,7 +244,7 @@
eval_some_python("xml_fetch", mycmd, NULL, NULL, params, &str, NULL);
if (str) {
- if (switch_strlen_zero(str)) {
+ if (zstr(str)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
} else if (!(xml = switch_xml_parse_str((char *) str, strlen(str)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
@@ -276,7 +276,7 @@
if (!strcmp(var, "xml-handler-script")) {
globals.xml_handler = switch_core_strdup(globals.pool, val);
} else if (!strcmp(var, "xml-handler-bindings")) {
- if (!switch_strlen_zero(globals.xml_handler)) {
+ if (!zstr(globals.xml_handler)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, val);
switch_xml_bind_search_function(python_fetch, switch_xml_parse_section_string(val), NULL);
}
@@ -397,7 +397,7 @@
SWITCH_STANDARD_API(launch_python)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "USAGE: %s\n", python_run_interface.syntax);
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_python/mod_python_wrap.cpp (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_python/mod_python_wrap.cpp 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_python/mod_python_wrap.cpp 2009-11-02 10:10:22 UTC (rev 15314)
@@ -7175,51 +7175,6 @@
}
-SWIGINTERN PyObject *_wrap_CoreSession_setCallerData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 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:CoreSession_setCallerData",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->setCallerData(arg2,arg3);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
-
-
SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -7608,7 +7563,7 @@
}
-SWIGINTERN PyObject *_wrap_CoreSession_collectDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_collectDigits__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
int arg2 ;
@@ -7639,6 +7594,102 @@
}
+SWIGINTERN PyObject *_wrap_CoreSession_collectDigits__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int arg2 ;
+ int arg3 ;
+ int result;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int val2 ;
+ int ecode2 = 0 ;
+ int val3 ;
+ int ecode3 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_collectDigits",&obj0,&obj1,&obj2)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2"" of type '" "int""'");
+ }
+ arg2 = static_cast< int >(val2);
+ ecode3 = SWIG_AsVal_int(obj2, &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_collectDigits" "', argument " "3"" of type '" "int""'");
+ }
+ arg3 = static_cast< int >(val3);
+ result = (int)(arg1)->collectDigits(arg2,arg3);
+ resultobj = SWIG_From_int(static_cast< int >(result));
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_collectDigits(PyObject *self, PyObject *args) {
+ int argc;
+ PyObject *argv[4];
+ int ii;
+
+ if (!PyTuple_Check(args)) SWIG_fail;
+ argc = (int)PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args,ii);
+ }
+ if (argc == 2) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ {
+ int res = SWIG_AsVal_int(argv[1], NULL);
+ _v = SWIG_CheckState(res);
+ }
+ if (_v) {
+ return _wrap_CoreSession_collectDigits__SWIG_0(self, args);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ {
+ int res = SWIG_AsVal_int(argv[1], NULL);
+ _v = SWIG_CheckState(res);
+ }
+ if (_v) {
+ {
+ int res = SWIG_AsVal_int(argv[2], NULL);
+ _v = SWIG_CheckState(res);
+ }
+ if (_v) {
+ return _wrap_CoreSession_collectDigits__SWIG_1(self, args);
+ }
+ }
+ }
+ }
+
+fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_collectDigits'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " collectDigits(CoreSession *,int)\n"
+ " collectDigits(CoreSession *,int,int)\n");
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_CoreSession_getDigits__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -10378,7 +10429,6 @@
{ (char *)"CoreSession_hangupCause", _wrap_CoreSession_hangupCause, METH_VARARGS, NULL},
{ (char *)"CoreSession_getState", _wrap_CoreSession_getState, METH_VARARGS, NULL},
{ (char *)"CoreSession_recordFile", _wrap_CoreSession_recordFile, METH_VARARGS, NULL},
- { (char *)"CoreSession_setCallerData", _wrap_CoreSession_setCallerData, METH_VARARGS, NULL},
{ (char *)"CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL},
{ (char *)"CoreSession_destroy", _wrap_CoreSession_destroy, METH_VARARGS, NULL},
{ (char *)"CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback, METH_VARARGS, NULL},
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1015,7 +1015,7 @@
if ((mods = switch_xml_child(cfg, "modules"))) {
for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) {
const char *val = switch_xml_attr_soft(ld, "module");
- if (!switch_strlen_zero(val) && strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT)) {
+ if (!zstr(val) && strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
continue;
}
@@ -1405,7 +1405,7 @@
if (argc > 0) {
file_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- if (switch_strlen_zero(file_name)) {
+ if (zstr(file_name)) {
return JS_FALSE;
}
}
@@ -1542,7 +1542,7 @@
if (argc > 0) {
phrase_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- if (switch_strlen_zero(phrase_name)) {
+ if (zstr(phrase_name)) {
return JS_FALSE;
}
} else {
@@ -1555,7 +1555,7 @@
if (argc > 2) {
tmp = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
- if (!switch_strlen_zero(tmp)) {
+ if (!zstr(tmp)) {
phrase_lang = tmp;
}
}
@@ -1609,7 +1609,7 @@
}
JS_CallFunction(jss->cx, jss->obj, jss->on_hangup, argc, argv, &ret);
resp = JS_GetStringBytes(JS_ValueToString(jss->cx, ret));
- if (!switch_strlen_zero(resp)) {
+ if (!zstr(resp)) {
ret = !strcasecmp(resp, "exit") ? JS_FALSE : JS_TRUE;
}
}
@@ -1683,7 +1683,7 @@
if (argc > 0) {
file_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- if (switch_strlen_zero(file_name)) {
+ if (zstr(file_name)) {
return JS_FALSE;
}
}
@@ -1927,12 +1927,12 @@
voice_name = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
text = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
- if (switch_strlen_zero(tts_name)) {
+ if (zstr(tts_name)) {
eval_some_js("~throw new Error(\"Invalid TTS Name\");", cx, obj, rval);
return JS_FALSE;
}
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
eval_some_js("~throw new Error(\"Invalid Text\");", cx, obj, rval);
return JS_FALSE;
}
@@ -2972,21 +2972,21 @@
}
- if (!switch_strlen_zero(jss->dialplan))
+ if (!zstr(jss->dialplan))
dialplan = jss->dialplan;
- if (!switch_strlen_zero(jss->caller_id_name))
+ if (!zstr(jss->caller_id_name))
cid_name = jss->caller_id_name;
- if (!switch_strlen_zero(jss->caller_id_number))
+ if (!zstr(jss->caller_id_number))
cid_num = jss->caller_id_number;
- if (!switch_strlen_zero(jss->ani))
+ if (!zstr(jss->ani))
ani = jss->ani;
- if (!switch_strlen_zero(jss->aniii))
+ if (!zstr(jss->aniii))
aniii = jss->aniii;
- if (!switch_strlen_zero(jss->rdnis))
+ if (!zstr(jss->rdnis))
rdnis = jss->rdnis;
- if (!switch_strlen_zero(jss->context))
+ if (!zstr(jss->context))
context = jss->context;
- if (!switch_strlen_zero(jss->username))
+ if (!zstr(jss->username))
username = jss->username;
dest = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
@@ -2998,7 +2998,7 @@
if (argc > 2) {
tmp = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
- if (!switch_strlen_zero(tmp)) {
+ if (!zstr(tmp)) {
to = tmp;
}
}
@@ -3678,7 +3678,7 @@
struct js_task *task;
switch_memory_pool_t *pool;
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "missing required input!\n");
return;
}
@@ -3707,11 +3707,11 @@
path_info = switch_event_get_header(stream->param_event, "http-path-info");
}
- if (switch_strlen_zero(cmd) && path_info) {
+ if (zstr(cmd) && path_info) {
cmd = path_info;
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "USAGE: %s\n", jsapi_interface->syntax);
return SWITCH_STATUS_SUCCESS;
}
@@ -3727,7 +3727,7 @@
SWITCH_STANDARD_API(launch_async)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "USAGE: %s\n", js_run_interface->syntax);
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -144,7 +144,7 @@
if (argc > 5) {
cred = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
- if (!switch_strlen_zero(cred)) {
+ if (!zstr(cred)) {
curl_easy_setopt(co->curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_easy_setopt(co->curl_handle, CURLOPT_USERPWD, cred);
}
@@ -174,7 +174,7 @@
data = "";
}
curl_easy_setopt(co->curl_handle, CURLOPT_POSTFIELDS, data);
- } else if (!switch_strlen_zero(data)) {
+ } else if (!zstr(data)) {
durl = switch_mprintf("%s?%s", url, data);
url_p = durl;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -128,11 +128,11 @@
}
}
- if (switch_strlen_zero(username)) {
+ if (zstr(username)) {
username = NULL;
}
- if (switch_strlen_zero(password)) {
+ if (zstr(password)) {
password = NULL;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_yaml/mod_yaml.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_yaml/mod_yaml.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/languages/mod_yaml/mod_yaml.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -404,7 +404,7 @@
char *path = NULL;
FILE *input;
- if (!switch_strlen_zero(alt_path)) {
+ if (!zstr(alt_path)) {
path = strdup(alt_path);
} else {
path = switch_mprintf("%s/yaml/extensions.yaml", SWITCH_GLOBAL_dirs.conf_dir);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/loggers/mod_console/mod_console.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/loggers/mod_console/mod_console.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/loggers/mod_console/mod_console.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -130,7 +130,7 @@
#else
COLORIZE = 1;
#endif
- } else if (!strcasecmp(var, "loglevel") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "loglevel") && !zstr(val)) {
hard_log_level = switch_log_str2level(val);
}
}
@@ -255,68 +255,95 @@
SWITCH_STANDARD_API(console_api_function)
{
int argc;
- char *mydata = NULL, *argv[3];
- const char *err = NULL;
+ char *mycmd = NULL, *argv[3] = { 0 };
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+ const char *usage_string = "USAGE:\n"
+ "--------------------------------------------------------------------------------\n"
+ "console help\n"
+ "console loglevel [[0-7] | <loglevel_string>]\n"
+ "console colorize [on|off|toggle]\n"
+ "--------------------------------------------------------------------------------\n";
+ const char *loglevel_usage_string = "USAGE:\n"
+ "--------------------------------------------------------------------------------\n"
+ "console loglevel [[0-7] | <loglevel_string>]\n"
+ "\n"
+ "Set the logging verbosity of the console from 0 (least verbose) to\n"
+ "7 (debugging), or specify the loglevel as a string:\n"
+ "\n"
+ " 0 console\n"
+ " 1 alert\n"
+ " 2 crit\n"
+ " 3 err\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";
- if (!cmd) {
- err = "bad args";
- goto end;
+ if (session)
+ return SWITCH_STATUS_FALSE;
+
+ if (zstr(cmd)) {
+ stream->write_function(stream, "%s", usage_string);
+ goto done;
}
- mydata = strdup(cmd);
- assert(mydata);
+ if (!(mycmd = strdup(cmd))) {
+ status = SWITCH_STATUS_MEMERR;
+ goto done;
+ }
- argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ if (!(argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || !argv[0]) {
+ stream->write_function(stream, "%s", usage_string);
+ goto done;
+ }
- if (argc > 0) {
+ if (!strcasecmp(argv[0], "loglevel")) {
+ int level = hard_log_level;
- if (argc < 1) {
- err = "missing arg";
- goto end;
+ if (argc > 1) {
+ if (!strcasecmp(argv[1], "help")) {
+ stream->write_function(stream, "%s", loglevel_usage_string);
+ goto done;
+ } else if (*argv[1] > 47 && *argv[1] < 58) {
+ 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] : "");
+ } else {
+ hard_log_level = level;
+ stream->write_function(stream, "+OK console log level set to %s\n", switch_log_level2str(hard_log_level));
+ }
- if (!strcasecmp(argv[0], "loglevel")) {
- int level = hard_log_level;
-
- if (argc > 1) {
- if (*argv[1] > 47 && *argv[1] < 58) {
- level = atoi(argv[1]);
- } else {
- level = switch_log_str2level(argv[1]);
- }
- }
-
- if (level == SWITCH_LOG_INVALID) {
- stream->write_function(stream, "-ERR syntax error, console log level not set!\n");
+ } else if (!strcasecmp(argv[0], "colorize")) {
+ if (argc > 1) {
+ if (!strcasecmp(argv[1], "help")) {
+ stream->write_function(stream, "%s", colorize_usage_string);
+ goto done;
+ } else if (!strcasecmp(argv[1], "toggle")) {
+ COLORIZE ^= 1;
} else {
- hard_log_level = level;
- stream->write_function(stream, "+OK console log level set to %s\n", switch_log_level2str(hard_log_level));
- }
- goto end;
- } else if (!strcasecmp(argv[0], "colorize")) {
- if (argc > 1) {
COLORIZE = switch_true(argv[1]);
}
- stream->write_function(stream, "+OK console color %s\n", COLORIZE ? "enabled" : "disabled");
- goto end;
}
+ stream->write_function(stream, "+OK console color %s\n", COLORIZE ? "enabled" : "disabled");
- err = "invalid command";
-
+ } else { /* if (!strcasecmp(argv[0], "help")) { */
+ stream->write_function(stream, "%s", usage_string);
}
-
- end:
-
- if (err) {
- stream->write_function(stream, "-Error %s\n", err);
- }
-
-
- free(mydata);
-
- return SWITCH_STATUS_SUCCESS;
-
+done:
+ switch_safe_free(mycmd);
+ return status;
}
SWITCH_MODULE_LOAD_FUNCTION(mod_console_load)
@@ -329,9 +356,23 @@
/* 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, "console", "Console", console_api_function, "loglevel [level]|colorize [on|off]");
+ SWITCH_ADD_API(api_interface, "console", "Console", console_api_function, "loglevel [level]|colorize [on|toggle|off]");
+ switch_console_set_complete("add console help");
switch_console_set_complete("add console loglevel");
+ switch_console_set_complete("add console loglevel help");
+ switch_console_set_complete("add console loglevel console");
+ switch_console_set_complete("add console loglevel alert");
+ switch_console_set_complete("add console loglevel crit");
+ switch_console_set_complete("add console loglevel err");
+ switch_console_set_complete("add console loglevel warning");
+ switch_console_set_complete("add console loglevel notice");
+ switch_console_set_complete("add console loglevel info");
+ switch_console_set_complete("add console loglevel debug");
switch_console_set_complete("add console colorize");
+ switch_console_set_complete("add console colorize help");
+ switch_console_set_complete("add console colorize on");
+ switch_console_set_complete("add console colorize off");
+ switch_console_set_complete("add console colorize toggle");
/* setup my logger function */
switch_log_bind_logger(switch_console_logger, SWITCH_LOG_DEBUG, SWITCH_TRUE);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/loggers/mod_logfile/mod_logfile.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/loggers/mod_logfile/mod_logfile.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/loggers/mod_logfile/mod_logfile.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -277,7 +277,7 @@
}
}
- if (switch_strlen_zero(new_profile->logfile)) {
+ if (zstr(new_profile->logfile)) {
char logfile[512];
switch_snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch.log");
new_profile->logfile = strdup(logfile);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/loggers/mod_syslog/mod_syslog.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/loggers/mod_syslog/mod_syslog.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/loggers/mod_syslog/mod_syslog.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -49,10 +49,12 @@
static struct {
char *ident;
char *format;
+ char *facility;
} globals;
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ident, globals.ident);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_format, globals.format);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_facility, globals.facility);
static switch_loadable_module_interface_t console_module_interface = {
/*.module_name */ modname,
@@ -99,7 +101,7 @@
}
/* don't log blank lines */
- if (!switch_strlen_zero(node->data) && (strspn(node->data, " \t\r\n") < strlen(node->data))) {
+ if (!zstr(node->data) && (strspn(node->data, " \t\r\n") < strlen(node->data))) {
syslog(syslog_level, "%s", node->data);
}
@@ -126,7 +128,9 @@
set_global_ident(val);
} else if (!strcmp(var, "format")) {
set_global_format(val);
- } else if (!strcasecmp(var, "loglevel") && !switch_strlen_zero(val)) {
+ } else if (!strcmp(var, "facility")) {
+ set_global_facility(val);
+ } else if (!strcasecmp(var, "loglevel") && !zstr(val)) {
log_level = switch_log_str2level(val);
if (log_level == SWITCH_LOG_INVALID) {
log_level = SWITCH_LOG_WARNING;
@@ -138,13 +142,15 @@
switch_xml_free(xml);
}
- if (switch_strlen_zero(globals.ident)) {
+ if (zstr(globals.ident)) {
set_global_ident(DEFAULT_IDENT);
}
- if (switch_strlen_zero(globals.format)) {
+ if (zstr(globals.format)) {
set_global_format(DEFAULT_FORMAT);
}
-
+ if (zstr(globals.facility)) {
+ set_global_facility(DEFAULT_FACILITY);
+ }
return 0;
}
@@ -173,6 +179,7 @@
switch_safe_free(globals.ident);
switch_safe_free(globals.format);
+ switch_safe_free(globals.facility);
switch_log_unbind_logger(mod_syslog_logger);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -89,7 +89,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Rotating log file paths\n");
- if (!switch_strlen_zero(globals.base_log_dir)) {
+ if (!zstr(globals.base_log_dir)) {
if (globals.rotate) {
if ((path = switch_mprintf("%s%s%s", globals.base_log_dir, SWITCH_PATH_SEPARATOR, date))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Rotating log file path to %s\n", path);
@@ -131,7 +131,7 @@
}
}
- if (!switch_strlen_zero(globals.base_err_log_dir)) {
+ if (!zstr(globals.base_err_log_dir)) {
if (globals.rotate) {
if ((path = switch_mprintf("%s%s%s", globals.base_err_log_dir, SWITCH_PATH_SEPARATOR, date))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Rotating err log file path to %s\n", path);
@@ -223,7 +223,7 @@
logdir = globals.log_dir;
}
- if (!switch_strlen_zero(logdir)) {
+ if (!zstr(logdir)) {
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) {
@@ -280,7 +280,7 @@
goto error;
}
- if (!switch_strlen_zero(globals.cred)) {
+ if (!zstr(globals.cred)) {
curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_easy_setopt(curl_handle, CURLOPT_USERPWD, globals.cred);
}
@@ -474,15 +474,15 @@
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
- if (!strcasecmp(var, "cred") && !switch_strlen_zero(val)) {
+ if (!strcasecmp(var, "cred") && !zstr(val)) {
globals.cred = switch_core_strdup(globals.pool, val);
- } else if (!strcasecmp(var, "url") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "url") && !zstr(val)) {
if (globals.url_count >= MAX_URLS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "maximum urls configured!\n");
} else {
globals.urls[globals.url_count++] = switch_core_strdup(globals.pool, val);
}
- } else if (!strcasecmp(var, "delay") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "delay") && !zstr(val)) {
globals.delay = (uint32_t) atoi(val);
} else if (!strcasecmp(var, "log-b-leg")) {
globals.log_b = switch_true(val);
@@ -490,18 +490,18 @@
globals.prefix_a = switch_true(val);
} else if (!strcasecmp(var, "disable-100-continue") && switch_true(val)) {
globals.disable100continue = 1;
- } else if (!strcasecmp(var, "encode") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "encode") && !zstr(val)) {
if (!strcasecmp(val, "base64")) {
globals.encode = 2;
} else {
globals.encode = switch_true(val) ? 1 : 0;
}
- } else if (!strcasecmp(var, "retries") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "retries") && !zstr(val)) {
globals.retries = (uint32_t) atoi(val);
- } else if (!strcasecmp(var, "rotate") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "rotate") && !zstr(val)) {
globals.rotate = switch_true(val);
} else if (!strcasecmp(var, "log-dir")) {
- if (switch_strlen_zero(val)) {
+ if (zstr(val)) {
globals.base_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
} else {
if (switch_is_file_path(val)) {
@@ -511,7 +511,7 @@
}
}
} else if (!strcasecmp(var, "err-log-dir")) {
- if (switch_strlen_zero(val)) {
+ if (zstr(val)) {
globals.base_err_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
} else {
if (switch_is_file_path(val)) {
@@ -536,8 +536,8 @@
globals.enable_ssl_verifyhost = 1;
}
- if (switch_strlen_zero(globals.base_err_log_dir)) {
- if (!switch_strlen_zero(globals.base_log_dir)) {
+ 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);
} else {
globals.base_err_log_dir = switch_core_sprintf(globals.pool, "%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -55,6 +55,7 @@
char *cookie_file;
switch_hash_t *vars_map;
int use_dynamic_url;
+ int auth_scheme;
};
static int keep_files_around = 0;
@@ -89,7 +90,7 @@
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
@@ -216,8 +217,8 @@
config_data.max_bytes = XML_CURL_MAX_BYTES;
if ((config_data.fd = open(filename, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
- if (!switch_strlen_zero(binding->cred)) {
- curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+ if (!zstr(binding->cred)) {
+ curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, binding->auth_scheme);
curl_easy_setopt(curl_handle, CURLOPT_USERPWD, binding->cred);
}
curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
@@ -353,9 +354,11 @@
uint32_t enable_ssl_verifyhost = 0;
char *cookie_file = NULL;
hash_node_t* hash_node;
+ int auth_scheme = CURLAUTH_BASIC;
need_vars_map = 0;
vars_map = NULL;
+
for (param = switch_xml_child(binding_tag, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
@@ -366,6 +369,23 @@
}
} else if (!strcasecmp(var, "gateway-credentials")) {
bind_cred = val;
+ } else if (!strcasecmp(var, "auth-scheme")) {
+ if (*val == '=') {
+ auth_scheme = 0;
+ val++;
+ }
+
+ if (!strcasecmp(val, "basic")) {
+ auth_scheme |= CURLAUTH_BASIC;
+ } else if (!strcasecmp(val, "digest")) {
+ auth_scheme |= CURLAUTH_DIGEST;
+ } else if (!strcasecmp(val, "NTLM")) {
+ auth_scheme |= CURLAUTH_NTLM;
+ } else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
+ auth_scheme |= CURLAUTH_GSSNEGOTIATE;
+ } else if (!strcasecmp(val, "any")) {
+ auth_scheme = CURLAUTH_ANY;
+ }
} else if (!strcasecmp(var, "disable-100-continue") && switch_true(val)) {
disable100continue = 1;
} else if (!strcasecmp(var, "method")) {
@@ -419,6 +439,8 @@
}
memset(binding, 0, sizeof(*binding));
+ binding->auth_scheme = auth_scheme;
+
binding->url = strdup(url);
switch_assert(binding->url);
@@ -486,7 +508,7 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n",
- switch_strlen_zero(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all");
+ zstr(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all");
switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(binding->bindings), binding);
x++;
binding = NULL;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -93,7 +93,7 @@
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
@@ -466,7 +466,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] (%s) [%s]\n",
- switch_strlen_zero(bname) ? "N/A" : bname, binding->basedn, binding->filter, binding->bindings ? binding->bindings : "all");
+ zstr(bname) ? "N/A" : bname, binding->basedn, binding->filter, binding->bindings ? binding->bindings : "all");
switch_xml_bind_search_function(xml_ldap_search, switch_xml_parse_section_string(bname), binding);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -257,7 +257,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] (%s) [%s]\n",
- switch_strlen_zero(bname) ? "N/A" : bname, binding->basedn, binding->filter, binding->bindings ? binding->bindings : "all");
+ zstr(bname) ? "N/A" : bname, binding->basedn, binding->filter, binding->bindings ? binding->bindings : "all");
switch_xml_bind_search_function(xml_ldap_search, switch_xml_parse_section_string(bname), binding);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -257,7 +257,7 @@
return FALSE;
}
- if (switch_strlen_zero(globals.realm) && switch_strlen_zero(globals.user)) {
+ if (zstr(globals.realm) && zstr(globals.user)) {
return TRUE;
}
@@ -272,12 +272,12 @@
domain_name = dp;
}
- if (!switch_strlen_zero(globals.realm) && !switch_strlen_zero(globals.user) && !strcmp(user, globals.user)) {
+ if (!zstr(globals.realm) && !zstr(globals.user) && !strcmp(user, globals.user)) {
switch_safe_free(user);
return TRUE;
}
- if (switch_strlen_zero(user) || switch_strlen_zero(domain_name)) {
+ if (zstr(user) || zstr(domain_name)) {
switch_safe_free(user);
return FALSE;
}
@@ -352,11 +352,11 @@
}
}
- if (switch_strlen_zero(user) || switch_strlen_zero(domain_name)) {
+ if (zstr(user) || zstr(domain_name)) {
goto fail;
}
- if (!switch_strlen_zero(globals.realm) && !switch_strlen_zero(globals.user) && !switch_strlen_zero(globals.pass)) {
+ if (!zstr(globals.realm) && !zstr(globals.user) && !zstr(globals.pass)) {
if (at) {
switch_snprintf(z, sizeof(z), "%s@%s:%s", globals.user, globals.realm, globals.pass);
} else {
@@ -374,7 +374,7 @@
}
- if (!switch_strlen_zero(mypass2) && !strcasecmp(mypass2, "user-choose")) {
+ if (!zstr(mypass2) && !strcasecmp(mypass2, "user-choose")) {
mypass2 = NULL;
}
@@ -872,7 +872,7 @@
relative_oid = oid;
}
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
switch_copy_string(buf, data, sizeof(buf));
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -273,9 +273,10 @@
char *opts;
char opts_str[1024] = "";
char *local_argv[1024] = { 0 };
+ int local_argc = argc;
char *arg_argv[128] = { 0 };
char *usageDesc;
- int alt_dirs = 0;
+ int alt_dirs = 0, log_set = 0, run_set = 0, kill = 0;
int known_opt;
int high_prio = 0;
#ifdef __sun
@@ -300,7 +301,7 @@
strncpy(opts_str, opts, sizeof(opts_str) - 1);
i = switch_separate_string(opts_str, ' ', arg_argv, (sizeof(arg_argv) / sizeof(arg_argv[0])));
for (x = 0; x < i; x++) {
- local_argv[argc++] = arg_argv[x];
+ local_argv[local_argc++] = arg_argv[x];
}
}
@@ -339,7 +340,7 @@
"\t-htdocs [htdocsdir] -- specify an alternate htdocs dir\n"
"\t-scripts [scriptsdir] -- specify an alternate scripts dir\n";
- for (x = 1; x < argc; x++) {
+ for (x = 1; x < local_argc; x++) {
known_opt = 0;
#ifdef WIN32
if (x == 1) {
@@ -497,7 +498,8 @@
}
if (local_argv[x] && !strcmp(local_argv[x], "-stop")) {
- return freeswitch_kill_background();
+ kill++;
+ known_opt++;
}
if (local_argv[x] && !strcmp(local_argv[x], "-nc")) {
@@ -553,6 +555,7 @@
}
strcpy(SWITCH_GLOBAL_dirs.log_dir, local_argv[x]);
alt_dirs++;
+ log_set++;
} else {
fprintf(stderr, "When using -log you must specify a log directory\n");
return 255;
@@ -569,6 +572,7 @@
return 255;
}
strcpy(SWITCH_GLOBAL_dirs.run_dir, local_argv[x]);
+ run_set++;
} else {
fprintf(stderr, "When using -run you must specify a pid directory\n");
return 255;
@@ -630,7 +634,20 @@
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) {
+ fprintf(stderr, "Allocation error\n");
+ return 255;
+ }
+ strcpy(SWITCH_GLOBAL_dirs.run_dir, SWITCH_GLOBAL_dirs.log_dir);
+ }
+ if (kill) {
+ return freeswitch_kill_background();
+ }
+
if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
fprintf(stderr, "FATAL ERROR! Could not initialize APR\n");
return 255;
@@ -671,10 +688,10 @@
setrlimit(RLIMIT_STACK, &rlp);
apr_terminate();
- ret = (int)execv(local_argv[0], local_argv);
+ ret = (int)execv(argv[0], argv);
for(i = 0; i < argc; i++) {
- switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", local_argv[i]);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[i]);
}
return system(buf);
@@ -764,13 +781,12 @@
char buf[1024] = "";
int j = 0;
- switch_assert(local_argv[0]);
switch_sleep(1000000);
- ret = (int)execv(local_argv[0], local_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++) {
- switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", local_argv[j]);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[j]);
}
ret = system(buf);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_buffer.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_buffer.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_buffer.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -280,6 +280,18 @@
return w;
}
+SWITCH_DECLARE(switch_size_t) switch_buffer_slide_write(switch_buffer_t *buffer, const void *data, switch_size_t datalen)
+{
+ switch_size_t w;
+
+ if (!(w = switch_buffer_write(buffer, data, datalen))) {
+ switch_buffer_toss(buffer, datalen);
+ return switch_buffer_write(buffer, data, datalen);
+ }
+
+ return w;
+}
+
SWITCH_DECLARE(void) switch_buffer_destroy(switch_buffer_t **buffer)
{
if (buffer && *buffer) {
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_caller.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_caller.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_caller.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -33,8 +33,8 @@
#include <switch.h>
#include <switch_caller.h>
-#define profile_dup(a,b,p) if (!switch_strlen_zero(a)) { b = switch_core_strdup(p, a); } else { b = SWITCH_BLANK_STRING; }
-#define profile_dup_clean(a,b,p) if (!switch_strlen_zero(a)) { b = switch_var_clean_string(switch_clean_string(switch_core_strdup(p, a)));} else { b = SWITCH_BLANK_STRING; }
+#define profile_dup(a,b,p) if (!zstr(a)) { b = switch_core_strdup(p, a); } else { b = SWITCH_BLANK_STRING; }
+#define profile_dup_clean(a,b,p) if (!zstr(a)) { b = switch_var_clean_string(switch_clean_string(switch_core_strdup(p, a)));} else { b = SWITCH_BLANK_STRING; }
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memory_pool_t *pool,
const char *username,
@@ -57,11 +57,11 @@
context = "default";
}
- if (switch_strlen_zero(caller_id_name)) {
+ if (zstr(caller_id_name)) {
caller_id_name = "FreeSWITCH";
}
- if (switch_strlen_zero(caller_id_number)) {
+ if (zstr(caller_id_number)) {
caller_id_number = "0000000000";
}
@@ -78,7 +78,8 @@
profile_dup_clean(destination_number, profile->destination_number, pool);
profile->uuid = SWITCH_BLANK_STRING;
profile->chan_name = SWITCH_BLANK_STRING;
-
+ profile->callee_id_name = SWITCH_BLANK_STRING;
+ profile->callee_id_number = SWITCH_BLANK_STRING;
switch_set_flag(profile, SWITCH_CPF_SCREEN);
profile->pool = pool;
return profile;
@@ -95,6 +96,8 @@
profile_dup(tocopy->dialplan, profile->dialplan, pool);
profile_dup(tocopy->caller_id_name, profile->caller_id_name, pool);
profile_dup(tocopy->caller_id_number, profile->caller_id_number, pool);
+ profile_dup(tocopy->callee_id_name, profile->callee_id_name, pool);
+ profile_dup(tocopy->callee_id_number, profile->callee_id_number, pool);
profile_dup(tocopy->network_addr, profile->network_addr, pool);
profile_dup(tocopy->ani, profile->ani, pool);
profile_dup(tocopy->aniii, profile->aniii, pool);
@@ -139,15 +142,21 @@
if (!strcasecmp(name, "caller_id_name")) {
return caller_profile->caller_id_name;
}
+ if (!strcasecmp(name, "caller_id_number")) {
+ return caller_profile->caller_id_number;
+ }
+ if (!strcasecmp(name, "callee_id_name")) {
+ return caller_profile->callee_id_name;
+ }
+ if (!strcasecmp(name, "callee_id_number")) {
+ return caller_profile->callee_id_number;
+ }
if (!strcasecmp(name, "ani")) {
return caller_profile->ani;
}
if (!strcasecmp(name, "aniii")) {
return caller_profile->aniii;
}
- if (!strcasecmp(name, "caller_id_number")) {
- return caller_profile->caller_id_number;
- }
if (!strcasecmp(name, "network_addr")) {
return caller_profile->network_addr;
}
@@ -238,59 +247,59 @@
{
char header_name[1024];
- if (!switch_strlen_zero(caller_profile->username)) {
+ if (!zstr(caller_profile->username)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Username", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->username);
}
- if (!switch_strlen_zero(caller_profile->dialplan)) {
+ if (!zstr(caller_profile->dialplan)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Dialplan", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->dialplan);
}
- if (!switch_strlen_zero(caller_profile->caller_id_name)) {
+ if (!zstr(caller_profile->caller_id_name)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Name", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->caller_id_name);
}
- if (!switch_strlen_zero(caller_profile->caller_id_number)) {
+ if (!zstr(caller_profile->caller_id_number)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Number", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->caller_id_number);
}
- if (!switch_strlen_zero(caller_profile->network_addr)) {
+ if (!zstr(caller_profile->network_addr)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Network-Addr", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->network_addr);
}
- if (!switch_strlen_zero(caller_profile->ani)) {
+ if (!zstr(caller_profile->ani)) {
switch_snprintf(header_name, sizeof(header_name), "%s-ANI", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->ani);
}
- if (!switch_strlen_zero(caller_profile->aniii)) {
+ if (!zstr(caller_profile->aniii)) {
switch_snprintf(header_name, sizeof(header_name), "%s-ANI-II", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->aniii);
}
- if (!switch_strlen_zero(caller_profile->destination_number)) {
+ if (!zstr(caller_profile->destination_number)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Destination-Number", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->destination_number);
}
- if (!switch_strlen_zero(caller_profile->uuid)) {
+ if (!zstr(caller_profile->uuid)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Unique-ID", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->uuid);
}
- if (!switch_strlen_zero(caller_profile->source)) {
+ if (!zstr(caller_profile->source)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Source", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->source);
}
- if (!switch_strlen_zero(caller_profile->context)) {
+ if (!zstr(caller_profile->context)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Context", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->context);
}
- if (!switch_strlen_zero(caller_profile->rdnis)) {
+ if (!zstr(caller_profile->rdnis)) {
switch_snprintf(header_name, sizeof(header_name), "%s-RDNIS", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->rdnis);
}
- if (!switch_strlen_zero(caller_profile->chan_name)) {
+ if (!zstr(caller_profile->chan_name)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Name", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->chan_name);
}
- if (!switch_strlen_zero(caller_profile->profile_index)) {
+ if (!zstr(caller_profile->profile_index)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Profile-Index", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->profile_index);
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_channel.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_channel.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_channel.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1,4 +1,3 @@
-
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
@@ -120,6 +119,7 @@
switch_channel_state_t state;
switch_channel_state_t running_state;
uint32_t flags[CF_FLAG_MAX];
+ uint32_t caps[CC_FLAG_MAX];
uint8_t state_flags[CF_FLAG_MAX];
uint32_t private_flags;
uint32_t app_flags;
@@ -176,7 +176,7 @@
SWITCH_DECLARE(void) switch_channel_audio_sync(switch_channel_t *channel)
{
if (switch_channel_media_ready(channel)) {
- switch_core_session_message_t msg;
+ switch_core_session_message_t msg = { 0 };
msg.message_id = SWITCH_MESSAGE_INDICATE_AUDIO_SYNC;
msg.from = channel->name;
switch_core_session_receive_message(channel->session, &msg);
@@ -317,7 +317,7 @@
int i, argc;
char *argv[256];
- if (switch_strlen_zero(dtmf_string)) {
+ if (zstr(dtmf_string)) {
return SWITCH_STATUS_FALSE;
}
@@ -536,7 +536,7 @@
const char *val = NULL, *r = NULL;
switch_assert(channel != NULL);
- if (!switch_strlen_zero(varname)) {
+ if (!zstr(varname)) {
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *session;
if ((session = switch_core_session_locate(uuid))) {
@@ -599,7 +599,7 @@
const char *old = NULL;
switch_assert(channel != NULL);
- if (!switch_strlen_zero(channel->name)) {
+ if (!zstr(channel->name)) {
old = channel->name;
}
channel->name = NULL;
@@ -619,9 +619,68 @@
SWITCH_DECLARE(char *) switch_channel_get_name(switch_channel_t *channel)
{
switch_assert(channel != NULL);
- return (!switch_strlen_zero(channel->name)) ? channel->name : "N/A";
+ return (!zstr(channel->name)) ? channel->name : "N/A";
}
+SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t *channel, const char *name, const char *val)
+{
+ char *v;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+ switch_mutex_lock(channel->profile_mutex);
+
+ if (!zstr(val)) {
+ v = switch_core_strdup(channel->caller_profile->pool, val);
+ } else {
+ v = SWITCH_BLANK_STRING;
+ }
+
+ if (!strcasecmp(name, "dialplan")) {
+ channel->caller_profile->dialplan = v;
+ } else if (!strcasecmp(name, "username")) {
+ channel->caller_profile->username = v;
+ } else if (!strcasecmp(name, "caller_id_name")) {
+ channel->caller_profile->caller_id_name = v;
+ } else if (!strcasecmp(name, "caller_id_number")) {
+ channel->caller_profile->caller_id_number = v;
+ } else if (!strcasecmp(name, "callee_id_name")) {
+ channel->caller_profile->callee_id_name = v;
+ } else if (!strcasecmp(name, "callee_id_number")) {
+ channel->caller_profile->callee_id_number = v;
+ } else if (val && !strcasecmp(name, "caller_ton")) {
+ channel->caller_profile->caller_ton = (uint8_t) atoi(v);
+ } else if (val && !strcasecmp(name, "caller_numplan")) {
+ channel->caller_profile->caller_numplan = (uint8_t) atoi(v);
+ } else if (val && !strcasecmp(name, "destination_number_ton")) {
+ channel->caller_profile->destination_number_ton = (uint8_t) atoi(v);
+ } else if (val && !strcasecmp(name, "destination_number_numplan")) {
+ channel->caller_profile->destination_number_numplan = (uint8_t) atoi(v);
+ } else if (!strcasecmp(name, "ani")) {
+ channel->caller_profile->ani = v;
+ } else if (!strcasecmp(name, "aniii")) {
+ channel->caller_profile->aniii = v;
+ } else if (!strcasecmp(name, "network_addr")) {
+ channel->caller_profile->network_addr = v;
+ } else if (!strcasecmp(name, "rdnis")) {
+ channel->caller_profile->rdnis = v;
+ } else if (!strcasecmp(name, "destination_number")) {
+ channel->caller_profile->destination_number = v;
+ } else if (!strcasecmp(name, "uuid")) {
+ channel->caller_profile->uuid = v;
+ } else if (!strcasecmp(name, "source")) {
+ channel->caller_profile->source = v;
+ } else if (!strcasecmp(name, "context")) {
+ channel->caller_profile->context = v;
+ } else if (!strcasecmp(name, "chan_name")) {
+ channel->caller_profile->chan_name = v;
+ } else {
+ status = SWITCH_STATUS_FALSE;
+ }
+ switch_mutex_unlock(channel->profile_mutex);
+
+ return status;
+}
+
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)
{
@@ -630,9 +689,9 @@
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
- if (channel->variables && !switch_strlen_zero(varname)) {
+ if (channel->variables && !zstr(varname)) {
switch_event_del_header(channel->variables, varname);
- if (!switch_strlen_zero(value)) {
+ if (!zstr(value)) {
int ok = 1;
if (var_check) {
@@ -663,7 +722,7 @@
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
- if (channel->variables && !switch_strlen_zero(varname)) {
+ if (channel->variables && !zstr(varname)) {
switch_event_del_header(channel->variables, varname);
va_start(ap, fmt);
@@ -691,7 +750,7 @@
const char *uuid;
switch_assert(channel != NULL);
- if (!switch_strlen_zero(varname)) {
+ if (!zstr(varname)) {
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *session;
if ((session = switch_core_session_locate(uuid))) {
@@ -841,6 +900,33 @@
return SWITCH_STATUS_SUCCESS;
}
+
+SWITCH_DECLARE(void) switch_channel_set_cap(switch_channel_t *channel, switch_channel_cap_t cap)
+{
+ switch_assert(channel);
+ switch_assert(channel->flag_mutex);
+
+ switch_mutex_lock(channel->flag_mutex);
+ channel->caps[cap] = 1;
+ switch_mutex_unlock(channel->flag_mutex);
+}
+
+SWITCH_DECLARE(void) switch_channel_clear_cap(switch_channel_t *channel, switch_channel_cap_t cap)
+{
+ switch_assert(channel != NULL);
+ switch_assert(channel->flag_mutex);
+
+ switch_mutex_lock(channel->flag_mutex);
+ channel->caps[cap] = 0;
+ switch_mutex_unlock(channel->flag_mutex);
+}
+
+SWITCH_DECLARE(uint32_t) switch_channel_test_cap(switch_channel_t *channel, switch_channel_cap_t cap)
+{
+ switch_assert(channel != NULL);
+ return channel->caps[cap] ? 1 : 0;
+}
+
SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel_t *channel, switch_channel_flag_t flag)
{
switch_assert(channel);
@@ -994,7 +1080,7 @@
ret = 0;
if (!channel->hangup_cause && channel->state > CS_ROUTING && channel->state < CS_HANGUP && channel->state != CS_RESET &&
- !switch_channel_test_flag(channel, CF_TRANSFER)) {
+ !switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_NOT_READY)) {
ret++;
}
@@ -1408,6 +1494,7 @@
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
) {
@@ -1663,6 +1750,88 @@
switch_mutex_unlock(channel->state_mutex);
}
+SWITCH_DECLARE(void) switch_channel_restart(switch_channel_t *channel)
+{
+ switch_channel_set_state(channel, CS_RESET);
+ switch_channel_wait_for_state_timeout(channel, CS_RESET, 5000);
+ switch_channel_set_state(channel, CS_EXECUTE);
+}
+
+/* XXX This is a somewhat simple operation. Were essentially taking the extension that one channel
+ was executing and generating a new extension for another channel that starts out where the
+ original one left off with an optional forward offset. Since all we are really doing is
+ copying a few basic pool-allocated structures from one channel to another there really is
+ not much to worry about here in terms of threading since we use read-write locks.
+ While the features are nice, they only really are needed in one specific crazy attended
+ transfer scenario where one channel was in the middle of calling a particular extension
+ when it was rudely cut off by a transfer key press. XXX */
+
+SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switch_channel_t *orig_channel, switch_channel_t *new_channel, uint32_t offset)
+{
+ switch_caller_profile_t *caller_profile;
+ switch_caller_extension_t *extension = NULL, *orig_extension = NULL;
+ switch_caller_application_t *ap;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_event_header_t *hi = NULL;
+ const char *no_copy = switch_channel_get_variable(orig_channel, "attended_transfer_no_copy");
+ char *dup;
+ int i, argc = 0;
+ char *argv[128];
+
+ if (no_copy) {
+ dup = switch_core_session_strdup(new_channel->session, no_copy);
+ argc = switch_separate_string(dup, ',', argv, (sizeof(argv) / sizeof(argv[0])));
+ }
+
+
+ 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--) {
+ 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);
+
+ for (hi = orig_channel->variables->headers; hi; hi = hi->next) {
+ int ok = 1;
+ for (i = 0; i < argc; i++) {
+ if (!strcasecmp(argv[i], hi->name)) {
+ ok = 0;
+ break;
+ }
+ }
+
+ if (!ok) continue;
+
+ switch_channel_set_variable(new_channel, hi->name, hi->value);
+ }
+
+ status = SWITCH_STATUS_SUCCESS;
+ }
+
+
+ switch_mutex_unlock(new_channel->profile_mutex);
+ switch_mutex_unlock(orig_channel->profile_mutex);
+
+
+ return status;
+}
+
SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension)
{
switch_assert(channel != NULL);
@@ -1706,10 +1875,11 @@
switch_channel_clear_flag(channel, CF_BLOCK_STATE);
if (channel->state < CS_HANGUP) {
- switch_channel_state_t last_state = channel->state;
+ switch_channel_state_t last_state;
switch_event_t *event;
switch_mutex_lock(channel->state_mutex);
+ last_state = channel->state;
channel->state = CS_HANGUP;
switch_mutex_unlock(channel->state_mutex);
@@ -1783,6 +1953,8 @@
SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_channel_t *channel, const char *file, const char *func, int line)
{
switch_event_t *event;
+ const char *var = NULL;
+ char *app;
if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
const char *uuid;
@@ -1814,6 +1986,16 @@
switch_mutex_unlock(channel->profile_mutex);
}
+ 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);
+ if ((arg = strchr(app, ' '))) {
+ *arg++ = '\0';
+ }
+ switch_core_session_execute_application(channel->session, app, arg);
+ }
+
/* if we're the child of another channel and the other channel is in a blocking read they will never realize we have answered so send
a SWITCH_SIG_BREAK to interrupt any blocking reads on that channel
*/
@@ -1830,7 +2012,7 @@
SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel_t *channel, const char *file, const char *func, int line)
{
- switch_core_session_message_t msg;
+ switch_core_session_message_t msg = { 0 };
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_assert(channel != NULL);
@@ -1864,7 +2046,7 @@
SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel_t *channel, const char *file, const char *func, int line)
{
- switch_core_session_message_t msg;
+ switch_core_session_message_t msg = { 0 };
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_assert(channel != NULL);
@@ -1956,7 +2138,10 @@
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);
- if ((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE)) && !switch_strlen_zero(var)) {
+
+ 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);
@@ -1973,6 +2158,23 @@
}
}
+ if ((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE)) && !zstr(var)) {
+ switch_stream_handle_t stream = { 0 };
+ char *arg = NULL;
+
+ app = switch_core_session_strdup(channel->session, var);
+ if ((arg = strchr(app, ' '))) {
+ *arg++ = '\0';
+ }
+
+ 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);
+ free(stream.data);
+ }
+
switch_channel_audio_sync(channel);
return SWITCH_STATUS_SUCCESS;
@@ -1980,7 +2182,7 @@
SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *channel, const char *file, const char *func, int line)
{
- switch_core_session_message_t msg;
+ switch_core_session_message_t msg = { 0 };
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_assert(channel != NULL);
@@ -2027,7 +2229,7 @@
char *func_val = NULL;
int nv = 0;
- if (switch_strlen_zero(in)) {
+ if (zstr(in)) {
return (char *) in;
}
@@ -2308,7 +2510,7 @@
prof_names[10] = "uuid";
for (x = 0; prof[x]; x++) {
- if (switch_strlen_zero(prof[x])) {
+ if (zstr(prof[x])) {
continue;
}
new_len = (strlen(prof[x]) * 3) + 1;
@@ -2361,6 +2563,32 @@
return stream.data;
}
+SWITCH_DECLARE(switch_status_t) switch_channel_pass_callee_id(switch_channel_t *channel, switch_channel_t *other_channel)
+{
+ int x = 0;
+
+ switch_assert(channel);
+ switch_assert(other_channel);
+
+ switch_mutex_lock(channel->profile_mutex);
+ switch_mutex_lock(other_channel->profile_mutex);
+
+ if (!zstr(channel->caller_profile->callee_id_name)) {
+ other_channel->caller_profile->callee_id_name = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_name);
+ x++;
+ }
+
+ if (!zstr(channel->caller_profile->callee_id_number)) {
+ other_channel->caller_profile->callee_id_number = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_number);
+ x++;
+ }
+
+ switch_mutex_unlock(other_channel->profile_mutex);
+ switch_mutex_unlock(channel->profile_mutex);
+
+ return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+}
+
SWITCH_DECLARE(switch_status_t) switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event)
{
switch_status_t status;
@@ -2408,7 +2636,7 @@
ocp = switch_channel_get_originator_caller_profile(channel);
}
- if (!switch_strlen_zero(caller_profile->caller_id_name)) {
+ if (!zstr(caller_profile->caller_id_name)) {
cid_buf = switch_core_session_sprintf(channel->session, "\"%s\" <%s>", caller_profile->caller_id_name,
switch_str_nil(caller_profile->caller_id_number));
} else {
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_console.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_console.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_console.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -464,7 +464,7 @@
line = el_gets(el, &count);
if (count > 1) {
- if (!switch_strlen_zero(line)) {
+ if (!zstr(line)) {
char *cmd = strdup(line);
char *p;
const LineInfo *lf = el_line(el);
@@ -513,7 +513,7 @@
switch_copy_string(h->last, target, sizeof(h->last));
- if (!switch_strlen_zero(target)) {
+ if (!zstr(target)) {
if ((++h->hits % 4) == 0) {
fprintf(h->out, "\n");
}
@@ -841,15 +841,17 @@
SWITCH_DECLARE(void) switch_console_loop(void)
{
- char cmd[2048];
- int32_t activity = 1;
- switch_size_t x = 0;
-
+ char cmd[2048] = "";
+ int32_t activity = 1;
gethostname(hostname, sizeof(hostname));
while (running) {
int32_t arg;
-#ifndef _MSC_VER
+#ifdef _MSC_VER
+ DWORD read, i;
+ HANDLE stdinHandle = GetStdHandle(STD_INPUT_HANDLE);
+ INPUT_RECORD in[128];
+#else
fd_set rfds, efds;
struct timeval tv = { 0, 20000 };
#endif
@@ -863,12 +865,31 @@
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "\nfreeswitch@%s> ", hostname);
}
#ifdef _MSC_VER
- activity = WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 20);
+ activity = 0;
+ PeekConsoleInput(stdinHandle, in, 128, &read);
+ for (i = 0; i < read; i++) {
+ if (in[i].EventType == KEY_EVENT && !in[i].Event.KeyEvent.bKeyDown) {
+ activity = 1;
+ break;
+ }
+ }
- if (activity == 102) {
- fflush(stdout);
- continue;
+ 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);
FD_ZERO(&efds);
@@ -890,7 +911,7 @@
fflush(stdout);
continue;
}
-#endif
+
memset(&cmd, 0, sizeof(cmd));
for (x = 0; x < (sizeof(cmd) - 1); x++) {
int c = getchar();
@@ -911,6 +932,7 @@
if (cmd[0]) {
running = switch_console_process(cmd, 0);
}
+#endif
}
}
#endif
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -957,7 +957,7 @@
const char *dft = switch_xml_attr(x_list, "default");
switch_bool_t default_type = SWITCH_TRUE;
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
continue;
}
@@ -1346,13 +1346,6 @@
}
#endif
-/* no ctl-c mofo */
-static void handle_SIGINT(int sig)
-{
- if (sig);
- return;
-}
-
static void handle_SIGHUP(int sig)
{
if (sig) {
@@ -1400,34 +1393,34 @@
#endif
} else if (!strcasecmp(var, "colorize-console") && switch_true(val)) {
runtime.colorize_console = SWITCH_TRUE;
- } else if (!strcasecmp(var, "mailer-app") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "mailer-app") && !zstr(val)) {
runtime.mailer_app = switch_core_strdup(runtime.memory_pool, val);
} else if (!strcasecmp(var, "mailer-app-args") && val) {
runtime.mailer_app_args = switch_core_strdup(runtime.memory_pool, val);
- } else if (!strcasecmp(var, "sessions-per-second") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "sessions-per-second") && !zstr(val)) {
switch_core_sessions_per_second(atoi(val));
- } else if (!strcasecmp(var, "max_dtmf_duration") && !switch_strlen_zero(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") && !switch_strlen_zero(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") && !switch_strlen_zero(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, "max-sessions") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "max-sessions") && !zstr(val)) {
switch_core_session_limit(atoi(val));
- } else if (!strcasecmp(var, "rtp-start-port") && !switch_strlen_zero(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") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "rtp-end-port") && !zstr(val)) {
switch_rtp_set_end_port((switch_port_t) atoi(val));
#ifdef ENABLE_ZRTP
} else if (!strcasecmp(var, "rtp-enable-zrtp")) {
@@ -1463,7 +1456,7 @@
}
/* set signal handlers */
- signal(SIGINT, handle_SIGINT);
+ signal(SIGINT, SIG_IGN);
#ifdef SIGPIPE
signal(SIGPIPE, handle_SIGPIPE);
#endif
@@ -1535,6 +1528,28 @@
return switch_micro_time_now() - runtime.initiated;
}
+
+#ifdef _MSC_VER
+static void win_shutdown(void)
+{
+
+ 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);
+ /* cleanup */
+ CloseHandle(shutdown_event);
+ }
+}
+#endif
+
SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_t *val)
{
if (switch_test_flag((&runtime), SCF_SHUTTING_DOWN)) {
@@ -1579,18 +1594,25 @@
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.");
+ 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
+ win_shutdown();
+#endif
+
if (*val) {
switch_set_flag((&runtime), SCF_RESTART);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Restarting\n");
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Shutting down\n");
+#ifdef _MSC_VER
+ fclose(stdin);
+#endif
}
runtime.running = 0;
} else {
@@ -1600,11 +1622,19 @@
}
break;
case SCSC_SHUTDOWN:
+
+#ifdef _MSC_VER
+ win_shutdown();
+#endif
+
if (*val) {
switch_set_flag((&runtime), SCF_RESTART);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Restarting\n");
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Shutting down\n");
+#ifdef _MSC_VER
+ fclose(stdin);
+#endif
}
runtime.running = 0;
break;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_asr.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_asr.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_asr.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -96,7 +96,7 @@
switch_assert(ah != NULL);
- if (switch_strlen_zero(grammar)) {
+ if (zstr(grammar)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
@@ -111,7 +111,7 @@
while (data && *data == ' ') {
data++;
}
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
@@ -120,7 +120,7 @@
if (*data == '{') {
param_string = data + 1;
data = switch_find_end_paren(data, '{', '}');
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
status = SWITCH_STATUS_FALSE;
goto done;
} else {
@@ -130,7 +130,7 @@
}
/* set ASR params */
- if (!switch_strlen_zero(param_string)) {
+ if (!zstr(param_string)) {
char *param[256] = { 0 };
int i;
int argc = switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0])));
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_codec.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_codec.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_codec.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -280,10 +280,10 @@
if (session->write_codec && codec && session->write_impl.decoded_bytes_per_packet) {
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-write-codec-name", session->write_impl.iananame);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", session->write_impl.actual_samples_per_second);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", session->write_impl.iananame);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%d", session->write_impl.actual_samples_per_second);
if (session->write_impl.actual_samples_per_second != session->write_impl.samples_per_second) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-write-codec-rate", "%d",
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Reported-Write-Codec-Rate", "%d",
session->write_impl.actual_samples_per_second);
}
switch_event_fire(&event);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_file.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_file.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_file.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -46,17 +46,20 @@
char stream_name[128] = "";
char *rhs = NULL;
const char *spool_path = NULL;
+ int is_stream = 0;
if (switch_test_flag(fh, SWITCH_FILE_OPEN)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Handle already open\n");
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(file_path)) {
+ if (zstr(file_path)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Filename\n");
return SWITCH_STATUS_FALSE;
}
+ fh->flags = flags;
+
if (pool) {
fh->memory_pool = pool;
} else {
@@ -73,6 +76,7 @@
ext = stream_name;
file_path = rhs + 3;
fh->file_path = switch_core_strdup(fh->memory_pool, file_path);
+ is_stream = 1;
} else {
if ((flags & SWITCH_FILE_FLAG_WRITE)) {
@@ -100,7 +104,7 @@
if ((ext = strrchr(file_path, '.')) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown file Format [%s]\n", file_path);
- switch_goto_status(SWITCH_STATUS_FALSE, end);
+ switch_goto_status(SWITCH_STATUS_FALSE, fail);
}
ext++;
fh->file_path = switch_core_strdup(fh->memory_pool, file_path);
@@ -110,13 +114,13 @@
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, end);
+ switch_goto_status(SWITCH_STATUS_GENERR, fail);
}
fh->file = file;
fh->func = func;
fh->line = line;
- fh->flags = flags;
+
if (spool_path) {
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
@@ -151,16 +155,16 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Spool dir is set. Make sure [%s] is also a valid path\n", fh->spool_path);
}
UNPROTECT_INTERFACE(fh->file_interface);
- switch_goto_status(status, end);
+ switch_goto_status(status, fail);
}
if ((flags & SWITCH_FILE_FLAG_WRITE) &&
- !strstr(file_path, SWITCH_URL_SEPARATOR) && (status = switch_file_exists(file_path, fh->memory_pool)) != SWITCH_STATUS_SUCCESS) {
+ !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);
- switch_goto_status(status, end);
+ switch_goto_status(status, fail);
}
if ((flags & SWITCH_FILE_FLAG_READ)) {
@@ -187,8 +191,9 @@
}
switch_set_flag(fh, SWITCH_FILE_OPEN);
+ return status;
- end:
+ fail:
if (switch_test_flag(fh, SWITCH_FILE_FLAG_FREE_POOL)) {
switch_core_destroy_memory_pool(&fh->memory_pool);
@@ -493,9 +498,11 @@
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 (fh->file_interface->file_write(fh, fh->pre_buffer_data, &blen) != SWITCH_STATUS_SUCCESS) {
break;
}
+ fh->samples_out += blen;
}
}
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_hash.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_hash.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_hash.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -39,18 +39,25 @@
struct switch_hash {
Hash table;
+ switch_memory_pool_t *pool;
};
SWITCH_DECLARE(switch_status_t) switch_core_hash_init_case(switch_hash_t **hash, switch_memory_pool_t *pool, switch_bool_t case_sensitive)
{
switch_hash_t *newhash;
- newhash = switch_core_alloc(pool, sizeof(*newhash));
+ if (pool) {
+ newhash = switch_core_alloc(pool, sizeof(*newhash));
+ newhash->pool = pool;
+ } else {
+ switch_zmalloc(newhash, sizeof(*newhash));
+ }
+
switch_assert(newhash);
sqlite3HashInit(&newhash->table, case_sensitive ? SQLITE_HASH_BINARY : SQLITE_HASH_STRING, 1);
*hash = newhash;
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -58,7 +65,13 @@
{
switch_assert(hash != NULL && *hash != NULL);
sqlite3HashClear(&(*hash)->table);
+
+ if (!(*hash)->pool) {
+ free(*hash);
+ }
+
*hash = NULL;
+
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_io.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_io.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_io.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -112,6 +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_cond_next();
*frame = &runtime.dummy_cng_frame;
return SWITCH_STATUS_SUCCESS;
}
@@ -332,6 +334,10 @@
switch_bool_t ok = SWITCH_TRUE;
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;
+ }
+
if (bp->ready && switch_test_flag(bp, SMBF_READ_STREAM)) {
switch_mutex_lock(bp->read_mutex);
switch_buffer_write(bp->raw_read_buffer, read_frame->data, read_frame->datalen);
@@ -494,6 +500,10 @@
switch_bool_t ok = SWITCH_TRUE;
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;
+ }
+
if (bp->ready && switch_test_flag(bp, SMBF_READ_PING)) {
switch_mutex_lock(bp->read_mutex);
if (bp->callback) {
@@ -758,6 +768,11 @@
if (!bp->ready) {
continue;
}
+
+ if (!switch_channel_test_flag(session->channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bp, SMBF_ANSWER_REQ)) {
+ continue;
+ }
+
if (switch_test_flag(bp, SMBF_WRITE_STREAM)) {
switch_mutex_lock(bp->write_mutex);
@@ -1180,7 +1195,7 @@
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(dtmf_string)) {
+ if (zstr(dtmf_string)) {
return SWITCH_STATUS_FALSE;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_media_bug.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_media_bug.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_media_bug.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -235,7 +235,7 @@
switch_size_t bytes;
switch_codec_implementation_t read_impl = {0};
switch_codec_implementation_t write_impl = {0};
-
+ const char *p;
if (!switch_channel_media_ready(session->channel)) {
if (switch_channel_pre_answer(session->channel) != SWITCH_STATUS_SUCCESS) {
@@ -248,6 +248,11 @@
*new_bug = NULL;
+
+ 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);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_memory.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_memory.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_memory.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -139,7 +139,7 @@
return NULL;
}
- if (switch_strlen_zero(todup)) {
+ if (zstr(todup)) {
return SWITCH_BLANK_STRING;
}
@@ -235,7 +235,7 @@
return NULL;
}
- if (switch_strlen_zero(todup)) {
+ if (zstr(todup)) {
return SWITCH_BLANK_STRING;
}
@@ -275,7 +275,7 @@
return NULL;
}
- if (switch_strlen_zero(todup)) {
+ if (zstr(todup)) {
return SWITCH_BLANK_STRING;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_session.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_session.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_session.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -373,7 +373,7 @@
switch_assert(channel != NULL);
forwardvar = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
- if (!switch_strlen_zero(forwardvar)) {
+ if (!zstr(forwardvar)) {
forwardval = atoi(forwardvar) - 1;
}
if (forwardval <= 0) {
@@ -506,13 +506,27 @@
}
if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
- switch_channel_set_flag(peer_channel, CF_PROXY_MODE);
+ if (switch_channel_test_cap(peer_channel, CC_BYPASS_MEDIA)) {
+ 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_channel_clear_flag(channel, CF_PROXY_MODE);
+ }
}
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
- switch_channel_set_flag(peer_channel, CF_PROXY_MEDIA);
- if (switch_channel_test_flag(channel, CF_VIDEO)) {
- switch_channel_set_flag(peer_channel, CF_VIDEO);
+ if (switch_channel_test_cap(peer_channel, CC_PROXY_MEDIA)) {
+ switch_channel_set_flag(peer_channel, CF_PROXY_MEDIA);
+ if (switch_channel_test_flag(channel, CF_VIDEO)) {
+ 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_channel_clear_flag(channel, CF_PROXY_MEDIA);
}
}
@@ -562,6 +576,9 @@
"TRANSCODING_NECESSARY",
"AUDIO_SYNC",
"REQUEST_IMAGE_MEDIA",
+ "UUID_CHANGE",
+ "WARNING",
+ "DEBUG_AUDIO",
"INVALID"
};
@@ -582,17 +599,35 @@
return status;
}
- message->_file = file;
- message->_func = func;
- message->_line = line;
+ if (!message->_file) {
+ message->_file = file;
+ }
+ if (!message->_func) {
+ message->_func = func;
+ }
+
+ if (!message->_line) {
+ message->_line = line;
+ }
+
if (message->message_id > SWITCH_MESSAGE_INVALID) {
message->message_id = SWITCH_MESSAGE_INVALID;
}
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, 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_DEBUG, "%s receive message [%s]\n",
switch_channel_get_name(session->channel), message_names[message->message_id]);
+
+ 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");
+ status = SWITCH_STATUS_SUCCESS;
+ goto end;
+ }
+
if (session->endpoint_interface->io_routines->receive_message) {
status = session->endpoint_interface->io_routines->receive_message(session, message);
}
@@ -633,6 +668,9 @@
break;
}
+ end:
+
+ switch_core_session_free_message(&message);
switch_core_session_rwunlock(session);
return status;
@@ -684,11 +722,39 @@
if (switch_queue_trypush(session->message_queue, message) == SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_SUCCESS;
}
+
+ switch_core_session_kill_channel(session, SWITCH_SIG_BREAK);
+
+ if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) || switch_channel_test_flag(session->channel, CF_THREAD_SLEEPING)) {
+ switch_core_session_wake_session_thread(session);
+ }
}
return status;
}
+SWITCH_DECLARE(void) switch_core_session_free_message(switch_core_session_message_t **message)
+{
+ switch_core_session_message_t *to_free = *message;
+ int i;
+ char *s;
+
+ *message = NULL;
+
+ if (switch_test_flag(to_free, SCSMF_DYNAMIC)) {
+ 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];
+ switch_safe_free(s);
+ }
+
+ switch_safe_free(to_free);
+ }
+}
+
SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(switch_core_session_t *session, switch_core_session_message_t **message)
{
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -699,6 +765,11 @@
if (session->message_queue) {
if ((status = (switch_status_t) switch_queue_trypop(session->message_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
*message = (switch_core_session_message_t *) pop;
+ if ((*message)->delivery_time && (*message)->delivery_time > switch_epoch_time_now(NULL)) {
+ switch_core_session_queue_message(session, *message);
+ *message = NULL;
+ status = SWITCH_STATUS_FALSE;
+ }
}
}
@@ -709,12 +780,8 @@
{
switch_core_session_message_t *message;
- if (switch_core_session_dequeue_message(session, &message) == SWITCH_STATUS_SUCCESS) {
- if (switch_test_flag(message, SCSMF_DYNAMIC)) {
- switch_safe_free(message);
- } else {
- message = NULL;
- }
+ while (switch_core_session_dequeue_message(session, &message) == SWITCH_STATUS_SUCCESS) {
+ switch_core_session_free_message(&message);
}
return SWITCH_STATUS_SUCCESS;
@@ -907,17 +974,22 @@
return session->channel;
}
-SWITCH_DECLARE(void) switch_core_session_signal_state_change(switch_core_session_t *session)
+SWITCH_DECLARE(void) switch_core_session_wake_session_thread(switch_core_session_t *session)
{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- switch_io_event_hook_state_change_t *ptr;
-
/* 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);
}
+}
+SWITCH_DECLARE(void) switch_core_session_signal_state_change(switch_core_session_t *session)
+{
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+ switch_io_event_hook_state_change_t *ptr;
+
+ switch_core_session_wake_session_thread(session);
+
if (session->endpoint_interface->io_routines->state_change) {
status = session->endpoint_interface->io_routines->state_change(session);
}
@@ -1134,6 +1206,7 @@
SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(switch_core_session_t *session, const char *use_uuid)
{
switch_event_t *event;
+ switch_core_session_message_t msg = { 0 };
switch_assert(use_uuid);
@@ -1144,6 +1217,12 @@
return SWITCH_STATUS_FALSE;
}
+ msg.message_id = SWITCH_MESSAGE_INDICATE_UUID_CHANGE;
+ msg.from = switch_channel_get_name(session->channel);
+ msg.string_array_arg[0] = session->uuid_str;
+ msg.string_array_arg[1] = use_uuid;
+ switch_core_session_receive_message(session, &msg);
+
switch_event_create(&event, SWITCH_EVENT_CHANNEL_UUID);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Old-Unique-ID", session->uuid_str);
switch_core_hash_delete(session_manager.session_table, session->uuid_str);
@@ -1208,7 +1287,6 @@
session = switch_core_alloc(usepool, sizeof(*session));
session->pool = usepool;
- session->thread_id = switch_thread_self();
switch_core_memory_pool_set_data(session->pool, "__session", session);
@@ -1430,7 +1508,7 @@
char *myarg = NULL;
if (expanded) {
myarg = switch_mprintf("%s(%s)", app, expanded);
- } else if (!switch_strlen_zero(arg)) {
+ } else if (!zstr(arg)) {
myarg = switch_mprintf("%s(%s)", app, arg);
} else {
myarg = switch_mprintf("%s", app);
@@ -1519,11 +1597,11 @@
new_profile = switch_caller_profile_clone(session, profile);
new_profile->destination_number = switch_core_strdup(new_profile->pool, exten);
- if (!switch_strlen_zero(dialplan)) {
+ if (!zstr(dialplan)) {
new_profile->dialplan = switch_core_strdup(new_profile->pool, dialplan);
}
- if (!switch_strlen_zero(context)) {
+ if (!zstr(context)) {
new_profile->context = switch_core_strdup(new_profile->pool, context);
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_speech.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_speech.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_speech.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -45,7 +45,7 @@
char buf[256] = "";
char *param = NULL;
- if (!sh || !flags || switch_strlen_zero(module_name)) {
+ if (!sh || !flags || zstr(module_name)) {
return SWITCH_STATUS_FALSE;
}
@@ -102,7 +102,7 @@
switch_assert(sh != NULL);
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
@@ -117,7 +117,7 @@
while (data && *data == ' ') {
data++;
}
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
@@ -126,7 +126,7 @@
if (*data == '{') {
param_string = data + 1;
data = switch_find_end_paren(data, '{', '}');
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
status = SWITCH_STATUS_FALSE;
goto done;
} else {
@@ -136,7 +136,7 @@
}
/* set TTS params */
- if (!switch_strlen_zero(param_string)) {
+ if (!zstr(param_string)) {
char *param[256] = { 0 };
int i;
int argc = switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0])));
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_sqldb.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_sqldb.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_sqldb.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -40,6 +40,8 @@
switch_core_db_t *event_db;
switch_queue_t *sql_queue[2];
switch_memory_pool_t *memory_pool;
+ switch_event_node_t *event_node;
+ switch_thread_t *thread;
int thread_running;
} sql_manager;
@@ -177,7 +179,7 @@
if (itterations == 0) {
trans = 1;
}
-
+
/* ignore abnormally large strings sql strings as potential buffer overflow */
if (newlen < SQLLEN) {
itterations++;
@@ -314,7 +316,7 @@
char *state = switch_event_get_header_nil(event, "channel-state-number");
switch_channel_state_t state_i = CS_DESTROY;
- if (!switch_strlen_zero(state)) {
+ if (!zstr(state)) {
state_i = atoi(state);
}
@@ -373,7 +375,7 @@
const char *syntax = switch_event_get_header_nil(event, "syntax");
const char *key = switch_event_get_header_nil(event, "key");
const char *filename = switch_event_get_header_nil(event, "filename");
- if (!switch_strlen_zero(type) && !switch_strlen_zero(name)) {
+ if (!zstr(type) && !zstr(name)) {
sql =
switch_mprintf("insert into interfaces (type,name,description,syntax,key,filename) values('%q','%q','%q','%q','%q','%q')",
type, name, switch_str_nil(description), switch_str_nil(syntax), switch_str_nil(key), switch_str_nil(filename)
@@ -385,7 +387,7 @@
{
const char *type = switch_event_get_header_nil(event, "type");
const char *name = switch_event_get_header_nil(event, "name");
- if (!switch_strlen_zero(type) && !switch_strlen_zero(name)) {
+ if (!zstr(type) && !zstr(name)) {
sql = switch_mprintf("delete from interfaces where type='%q' and name='%q'", type, name);
}
break;
@@ -394,7 +396,7 @@
{
const char *type = switch_event_get_header_nil(event, "secure_type");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Secure Type: %s\n", type);
- if (switch_strlen_zero(type)) {
+ if (zstr(type)) {
break;
}
sql = switch_mprintf("update channels set secure='%s' where uuid='%s'",
@@ -440,8 +442,7 @@
void switch_core_sqldb_start(switch_memory_pool_t *pool)
{
- switch_thread_t *thread;
- switch_threadattr_t *thd_attr;;
+ switch_threadattr_t *thd_attr;
sql_manager.memory_pool = pool;
@@ -567,7 +568,8 @@
switch_core_db_exec(sql_manager.db, create_calls_sql, NULL, NULL, NULL);
switch_core_db_exec(sql_manager.db, create_interfaces_sql, NULL, NULL, NULL);
switch_core_db_exec(sql_manager.db, create_tasks_sql, NULL, NULL, NULL);
- if (switch_event_bind("core_db", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+
+ 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");
}
}
@@ -576,9 +578,8 @@
switch_queue_create(&sql_manager.sql_queue[1], SWITCH_SQL_QUEUE_LEN, sql_manager.memory_pool);
switch_threadattr_create(&thd_attr, sql_manager.memory_pool);
- switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_thread_create(&thread, thd_attr, switch_core_sql_thread, NULL, sql_manager.memory_pool);
+ switch_thread_create(&sql_manager.thread, thd_attr, switch_core_sql_thread, NULL, sql_manager.memory_pool);
while (!sql_manager.thread_running) {
switch_yield(10000);
@@ -587,16 +588,15 @@
void switch_core_sqldb_stop(void)
{
+ switch_status_t st;
+
+ switch_event_unbind(&sql_manager.event_node);
+
switch_queue_push(sql_manager.sql_queue[0], NULL);
switch_queue_push(sql_manager.sql_queue[1], NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Waiting for unfinished SQL transactions\n");
- while (switch_queue_size(sql_manager.sql_queue[0]) > 0) {
- switch_yield(10000);
- }
- while (switch_queue_size(sql_manager.sql_queue[1]) > 0) {
- switch_yield(10000);
- }
+ switch_thread_join(&st, sql_manager.thread);
switch_core_db_close(sql_manager.db);
switch_core_db_close(sql_manager.event_db);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_state_machine.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_state_machine.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_state_machine.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -85,7 +85,7 @@
char *dp[25];
int argc, x, count = 0;
- if (!switch_strlen_zero(caller_profile->dialplan)) {
+ if (!zstr(caller_profile->dialplan)) {
if ((dpstr = switch_core_session_strdup(session, caller_profile->dialplan))) {
expanded = switch_channel_expand_variables(session->channel, dpstr);
argc = switch_separate_string(expanded, ',', dp, (sizeof(dp) / sizeof(dp[0])));
@@ -375,7 +375,21 @@
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);
+
+ while (switch_core_session_dequeue_message(session, &message) == SWITCH_STATUS_SUCCESS) {
+ switch_core_session_receive_message(session, message);
+ message = NULL;
+ }
}
}
}
@@ -468,7 +482,7 @@
use_session = session;
}
- if (!switch_strlen_zero(hook_var)) {
+ if (!zstr(hook_var)) {
switch_stream_handle_t stream = { 0 };
char *cmd = switch_core_session_strdup(session, hook_var);
char *arg = NULL;
@@ -538,7 +552,7 @@
driver_state_handler = endpoint_interface->state_handler;
switch_assert(driver_state_handler != NULL);
- if (!switch_strlen_zero(var)) {
+ if (!zstr(var)) {
if (!strcasecmp(var, "a_only")) {
if (switch_channel_get_originator_caller_profile(session->channel)) {
do_extra_handlers = 0;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_timer.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_timer.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_core_timer.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -61,9 +61,7 @@
switch_set_flag(timer, SWITCH_TIMER_FLAG_FREE_POOL);
}
- timer->timer_interface->timer_init(timer);
- return SWITCH_STATUS_SUCCESS;
-
+ return timer->timer_interface->timer_init(timer);
}
SWITCH_DECLARE(switch_status_t) switch_core_timer_next(switch_timer_t *timer)
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_cpp.cpp (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_cpp.cpp 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_cpp.cpp 2009-11-02 10:10:22 UTC (rev 15314)
@@ -55,7 +55,7 @@
switch_name_event(event_name, &e_event_id);
switch_core_new_memory_pool(&pool);
- if (!switch_strlen_zero(subclass_name)) {
+ if (!zstr(subclass_name)) {
e_subclass_name = switch_core_strdup(pool, subclass_name);
} else {
e_subclass_name = NULL;
@@ -124,7 +124,7 @@
menu = NULL;
switch_core_new_memory_pool(&pool);
switch_assert(pool);
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
name = "no name";
}
@@ -227,7 +227,7 @@
event_id = SWITCH_EVENT_MESSAGE;
}
- if (!switch_strlen_zero(subclass_name) && event_id != SWITCH_EVENT_CUSTOM) {
+ if (!zstr(subclass_name) && event_id != SWITCH_EVENT_CUSTOM) {
switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_WARNING, "Changing event type to custom because you specified a subclass name!\n");
event_id = SWITCH_EVENT_CUSTOM;
}
@@ -981,8 +981,8 @@
handlers,
NULL,
NULL,
- &caller_profile,
NULL,
+ NULL,
SOF_NONE) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error Creating Outgoing Channel! [%s]\n", dest);
goto failed;
@@ -1078,41 +1078,6 @@
}
-SWITCH_DECLARE(void) CoreSession::setCallerData(char *var, char *val) {
-
- this_check_void();
- sanity_check_noreturn;
-
- if (strcmp(var, "dialplan") == 0) {
- caller_profile.dialplan = val;
- }
- if (strcmp(var, "context") == 0) {
- caller_profile.context = val;
- }
- if (strcmp(var, "caller_id_name") == 0) {
- caller_profile.caller_id_name = val;
- }
- if (strcmp(var, "caller_id_number") == 0) {
- caller_profile.caller_id_number = val;
- }
- if (strcmp(var, "network_addr") == 0) {
- caller_profile.network_addr = val;
- }
- if (strcmp(var, "ani") == 0) {
- caller_profile.ani = val;
- }
- if (strcmp(var, "aniii") == 0) {
- caller_profile.aniii = val;
- }
- if (strcmp(var, "rdnis") == 0) {
- caller_profile.rdnis = val;
- }
- if (strcmp(var, "username") == 0) {
- caller_profile.username = val;
- }
-
-}
-
SWITCH_DECLARE(void) CoreSession::setHangupHook(void *hangup_func) {
this_check_void();
@@ -1239,7 +1204,7 @@
this_check(SWITCH_STATUS_FALSE);
sanity_check(SWITCH_STATUS_FALSE);
- if (switch_strlen_zero(result)) {
+ if (zstr(result)) {
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_event.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_event.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_event.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -182,6 +182,7 @@
"NAT",
"RECORD_START",
"RECORD_STOP",
+ "CALL_UPDATE",
"ALL"
};
@@ -1070,7 +1071,7 @@
}
}
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
body = data;
} else if (event->body) {
body = event->body;
@@ -1605,7 +1606,7 @@
for (x = 0; prof[x]; x++) {
- if (switch_strlen_zero(prof[x])) {
+ if (zstr(prof[x])) {
continue;
}
new_len = (strlen(prof[x]) * 3) + 1;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -220,10 +220,10 @@
break;
}
- if (switch_core_session_private_event_count(session)) {
- switch_ivr_parse_all_events(session);
- }
+ switch_ivr_parse_all_events(session);
+
+
if (args && (args->input_callback || args->buf || args->buflen)) {
switch_dtmf_t dtmf;
@@ -463,7 +463,7 @@
char *event_lock = switch_event_get_header(event, "event-lock");
switch_status_t status = SWITCH_STATUS_FALSE;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Command!\n");
return SWITCH_STATUS_FALSE;
}
@@ -569,19 +569,19 @@
char *transport = switch_event_get_header(event, "transport");
char *flags = switch_event_get_header(event, "flags");
- if (switch_strlen_zero(local_ip)) {
+ if (zstr(local_ip)) {
local_ip = "127.0.0.1";
}
- if (switch_strlen_zero(remote_ip)) {
+ if (zstr(remote_ip)) {
remote_ip = "127.0.0.1";
}
- if (switch_strlen_zero(local_port)) {
+ if (zstr(local_port)) {
local_port = "8025";
}
- if (switch_strlen_zero(remote_port)) {
+ if (zstr(remote_port)) {
remote_port = "8026";
}
- if (switch_strlen_zero(transport)) {
+ if (zstr(transport)) {
transport = "udp";
}
@@ -624,12 +624,33 @@
}
+SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_messages(switch_core_session_t *session)
+{
+ 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);
+ message = NULL;
+ }
+
+ return i ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+}
+
SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_events(switch_core_session_t *session)
{
+ int x = 0;
- while (switch_ivr_parse_next_event(session) == SWITCH_STATUS_SUCCESS);
- switch_ivr_sleep(session, 0, SWITCH_TRUE, NULL);
+ switch_ivr_parse_all_messages(session);
+
+ while (switch_ivr_parse_next_event(session) == SWITCH_STATUS_SUCCESS) x++;
+
+ if (x) {
+ switch_ivr_sleep(session, 0, SWITCH_TRUE, NULL);
+ }
+
return SWITCH_STATUS_SUCCESS;
}
@@ -666,6 +687,7 @@
expires = switch_epoch_time_now(NULL) + timeout;
}
switch_channel_set_variable(channel, "park_timeout", NULL);
+ switch_channel_set_variable(channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE, NULL);
}
switch_channel_set_flag(channel, CF_CONTROLLED);
@@ -772,10 +794,9 @@
}
}
- if (switch_core_session_private_event_count(session)) {
- switch_ivr_parse_all_events(session);
- }
+ switch_ivr_parse_all_events(session);
+
if (switch_channel_has_dtmf(channel)) {
switch_dtmf_t dtmf = { 0 };
switch_channel_dequeue_dtmf(channel, &dtmf);
@@ -858,10 +879,10 @@
}
}
- if (switch_core_session_private_event_count(session)) {
- switch_ivr_parse_all_events(session);
- }
+ switch_ivr_parse_all_events(session);
+
+
if (switch_channel_has_dtmf(channel)) {
switch_channel_dequeue_dtmf(channel, &dtmf);
status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
@@ -951,7 +972,7 @@
*terminator = '\0';
}
- if (!switch_strlen_zero(terminators)) {
+ if (!zstr(terminators)) {
for (i = 0; i < x; i++) {
if (strchr(terminators, buf[i]) && terminator != NULL) {
*terminator = buf[i];
@@ -989,10 +1010,10 @@
}
}
- if (switch_core_session_private_event_count(session)) {
- switch_ivr_parse_all_events(session);
- }
+ switch_ivr_parse_all_events(session);
+
+
if (eff_timeout) {
digit_elapsed = (uint32_t) ((switch_micro_time_now() - digit_started) / 1000);
@@ -1017,7 +1038,7 @@
break;
}
- if (!switch_strlen_zero(terminators) && strchr(terminators, dtmf.digit) && terminator != NULL) {
+ if (!zstr(terminators) && strchr(terminators, dtmf.digit) && terminator != NULL) {
*terminator = dtmf.digit;
return SWITCH_STATUS_SUCCESS;
}
@@ -1150,7 +1171,7 @@
if ((session = switch_core_session_locate(uuid))) {
channel = switch_core_session_get_channel(session);
- if ((flags & SMF_REBRIDGE) && !switch_channel_test_flag(channel, CF_ORIGINATOR)) {
+ if ((flags & SMF_REBRIDGE) && !switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
swap = 1;
}
@@ -1214,7 +1235,7 @@
status = SWITCH_STATUS_SUCCESS;
channel = switch_core_session_get_channel(session);
- if ((flags & SMF_REBRIDGE) && !switch_channel_test_flag(channel, CF_ORIGINATOR)) {
+ if ((flags & SMF_REBRIDGE) && !switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
swap = 1;
}
@@ -1260,7 +1281,7 @@
const char *forwardvar = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
int forwardval = 70;
- if (!switch_strlen_zero(forwardvar)) {
+ if (!zstr(forwardvar)) {
forwardval = atoi(forwardvar) - 1;
}
if (forwardval <= 0) {
@@ -1280,23 +1301,26 @@
if ((profile = switch_channel_get_caller_profile(channel))) {
const char *var;
- if (switch_strlen_zero(dialplan)) {
+ if (zstr(dialplan)) {
dialplan = profile->dialplan;
+ if (!zstr(dialplan) && !strcasecmp(dialplan, "inline")) {
+ dialplan = NULL;
+ }
}
- if (switch_strlen_zero(context)) {
+ if (zstr(context)) {
context = profile->context;
}
- if (switch_strlen_zero(dialplan)) {
+ if (zstr(dialplan)) {
dialplan = "XML";
}
- if (switch_strlen_zero(context)) {
+ if (zstr(context)) {
context = "default";
}
- if (switch_strlen_zero(extension)) {
+ if (zstr(extension)) {
extension = "service";
}
@@ -1726,7 +1750,7 @@
return off;
for (; hi; hi = hi->next) {
- if (!switch_strlen_zero(hi->name) && !switch_strlen_zero(hi->value) && ((variable = switch_xml_add_child_d(xml, hi->name, off++)))) {
+ if (!zstr(hi->name) && !zstr(hi->value) && ((variable = switch_xml_add_child_d(xml, hi->name, off++)))) {
char *data;
switch_size_t dlen = strlen(hi->value) * 3;
@@ -1791,11 +1815,11 @@
goto error;
}
- if (!switch_strlen_zero(caller_profile->dialplan)) {
+ if (!zstr(caller_profile->dialplan)) {
switch_xml_set_attr_d(x_callflow, "dialplan", caller_profile->dialplan);
}
- if (!switch_strlen_zero(caller_profile->profile_index)) {
+ if (!zstr(caller_profile->profile_index)) {
switch_xml_set_attr_d(x_callflow, "profile_index", caller_profile->profile_index);
}
@@ -2161,7 +2185,7 @@
char * prefix_buffer = NULL, *prefix;
size_t buffer_size =0;
size_t prefix_size=0;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
goto error;
}
@@ -2184,7 +2208,7 @@
status = SWITCH_STATUS_SUCCESS;
- if (!switch_strlen_zero(prefix)) {
+ if (!zstr(prefix)) {
prefix_size = strlen(prefix);
buffer_size = 1024 + prefix_size + 1;
prefix_buffer = switch_core_session_alloc(session, buffer_size);
@@ -2243,6 +2267,20 @@
return status;
}
+SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid)
+{
+ switch_bool_t exists = SWITCH_FALSE;
+ switch_core_session_t *psession = NULL;
+
+ if ((psession = switch_core_session_locate(uuid))) {
+ switch_core_session_rwunlock(psession);
+ exists = 1;
+ }
+
+ return exists;
+}
+
+
/* For Emacs:
* Local Variables:
* mode:c
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_async.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_async.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_async.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -100,9 +100,7 @@
break;
}
- if (switch_core_session_private_event_count(session)) {
- switch_ivr_parse_all_events(session);
- }
+ switch_ivr_parse_all_events(session);
if (args && (args->input_callback || args->buf || args->buflen)) {
switch_dtmf_t dtmf;
@@ -427,6 +425,7 @@
char *file;
switch_file_handle_t *fh;
uint32_t packet_len;
+ int min_sec;
};
static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
@@ -461,23 +460,21 @@
}
if (rh->fh) {
- if (switch_channel_test_flag(channel, CF_ANSWERED) || !switch_core_media_bug_test_flag(bug, SMBF_RECORD_ANSWER_REQ)) {
- switch_size_t len;
- uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
- switch_frame_t frame = { 0 };
+ 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;
- 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);
- }
+ 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);
}
+
switch_core_file_close(rh->fh);
- if (rh->fh->samples_out < read_impl.samples_per_second * 3) {
+ if (rh->fh->samples_out < read_impl.samples_per_second * rh->min_sec) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file);
switch_file_remove(rh->file, switch_core_session_get_pool(session));
}
@@ -495,12 +492,11 @@
frame.data = data;
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
- if (switch_channel_test_flag(channel, CF_ANSWERED) || !switch_core_media_bug_test_flag(bug, SMBF_RECORD_ANSWER_REQ)) {
- 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);
- }
+ 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);
}
+
}
break;
case SWITCH_ABC_TYPE_WRITE:
@@ -655,7 +651,7 @@
}
- if (!switch_strlen_zero(require_group)) {
+ if (!zstr(require_group)) {
int argc, i;
int ok = 0;
char *argv[10] = { 0 };
@@ -753,7 +749,7 @@
if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
char *command = switch_event_get_header(event, "eavesdrop-command");
if (command) {
- fcommand = command;
+ fcommand = switch_core_session_strdup(session, command);
}
switch_event_destroy(&event);
}
@@ -907,13 +903,23 @@
}
}
+ if ((p = switch_channel_get_variable(channel, "RECORD_WRITE_ONLY")) && switch_true(p)) {
+ flags &= ~SMBF_READ_STREAM;
+ flags |= SMBF_WRITE_STREAM;
+ }
+
+ 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_RECORD_ANSWER_REQ;
+ flags |= SMBF_ANSWER_REQ;
}
@@ -958,7 +964,7 @@
}
}
- file = switch_core_session_sprintf(session, "%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file);
+ 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,
@@ -1016,7 +1022,17 @@
rh->fh = fh;
rh->file = switch_core_session_strdup(session, file);
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) {
+ rh->min_sec = tmp;
+ }
+ }
+
+
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);
@@ -1168,7 +1184,7 @@
int tr;
int err = 1;
SpeexPreprocessState *st = NULL;
- SpeexEchoState *ec;
+ SpeexEchoState *ec = NULL;
switch_mutex_t *mutex = NULL;
int r = 0;
@@ -1776,7 +1792,7 @@
switch_core_session_get_read_impl(session, &read_impl);
- if (switch_strlen_zero(key)) {
+ if (zstr(key)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No Key Specified!\n");
return SWITCH_STATUS_FALSE;
}
@@ -1788,7 +1804,7 @@
}
for (i = 0; i < cont->index; i++) {
- if (!switch_strlen_zero(cont->list[i].key) && !strcasecmp(key, cont->list[i].key)) {
+ if (!zstr(cont->list[i].key) && !strcasecmp(key, cont->list[i].key)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Re-enabling %s\n", key);
cont->list[i].up = 1;
cont->list[i].hits = 0;
@@ -1799,7 +1815,7 @@
}
}
- if (switch_strlen_zero(tone_spec)) {
+ if (zstr(tone_spec)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No Spec Specified!\n");
return SWITCH_STATUS_FALSE;
}
@@ -1878,7 +1894,7 @@
}
- if (switch_strlen_zero(flags)) {
+ if (zstr(flags)) {
bflags = SMBF_READ_REPLACE;
} else {
if (strchr(flags, 'o')) {
@@ -1938,7 +1954,13 @@
{
bch_t *bch = (bch_t *) obj;
+ if (!bch->session) {
+ return NULL;
+ }
+
+ switch_core_session_read_lock(bch->session);
switch_ivr_broadcast(switch_core_session_get_uuid(bch->session), bch->app, bch->flags);
+ switch_core_session_rwunlock(bch->session);
return NULL;
@@ -2031,8 +2053,6 @@
} else {
flags |= SMF_ECHO_ALEG;
}
- } else if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_INLINE)) {
- flags |= SMF_EXEC_INLINE;
} else if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_ALEG)) {
flags |= SMF_ECHO_ALEG;
} else if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_BLEG)) {
@@ -2041,6 +2061,10 @@
flags |= SMF_ECHO_ALEG;
}
+ 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);
@@ -2111,7 +2135,7 @@
switch_core_event_hook_add_recv_dtmf(session, meta_on_dtmf);
}
- if (!switch_strlen_zero(app)) {
+ if (!zstr(app)) {
if ((bind_flags & SBF_DIAL_ALEG)) {
md->sr[SWITCH_DTMF_RECV].up = 1;
md->sr[SWITCH_DTMF_RECV].map[key].app = switch_core_session_strdup(session, app);
@@ -2673,22 +2697,24 @@
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 (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(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");
- }
+ if ((flags & SMF_EXEC_INLINE)) {
+ switch_core_session_execute_application(other_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(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_EXEC_INLINE)) {
- switch_core_session_execute_application(other_session, app, path);
- } else {
+ 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);
}
}
@@ -2702,21 +2728,26 @@
nomedia = 0;
}
+
if ((flags & SMF_ECHO_ALEG)) {
- 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(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_EXEC_INLINE)) {
+ 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(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);
}
- 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);
}
master = session;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_bridge.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_bridge.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_bridge.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -30,7 +30,7 @@
*/
#include <switch.h>
-#define DEFAULT_LEAD_FRAMES 50
+#define DEFAULT_LEAD_FRAMES 5
static const switch_state_handler_table_t audio_bridge_peer_state_handlers;
@@ -78,6 +78,65 @@
}
#endif
+
+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;
+ switch_channel_t *caller_channel;
+ const char *name, *number, *p;
+
+ caller_channel = switch_core_session_get_channel(session);
+ caller_profile = switch_channel_get_caller_profile(caller_channel);
+
+ 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;
+ }
+ if (zstr(number)) {
+ number = caller_profile->destination_number;
+ }
+ } else {
+ name = caller_profile->caller_id_name;
+ number = caller_profile->caller_id_number;
+
+ if (zstr(name)) {
+ name = caller_profile->destination_number;
+ }
+ if (zstr(number)) {
+ number = caller_profile->destination_number;
+ }
+ }
+
+ if ((p = strrchr(number, '/'))) {
+ number = p+1;
+ }
+ if ((p = strrchr(name, '/'))) {
+ name = p+1;
+ }
+
+ msg = switch_core_session_alloc(peer_session, sizeof(*msg));
+ MESSAGE_STAMP_FFL(msg);
+ msg->message_id = SWITCH_MESSAGE_INDICATE_DISPLAY;
+ msg->string_array_arg[0] = switch_core_session_strdup(peer_session, name);
+ msg->string_array_arg[1] = switch_core_session_strdup(peer_session, number);
+ msg->from = __FILE__;
+ switch_core_session_queue_message(peer_session, msg);
+
+}
+
+
+SWITCH_DECLARE(void) switch_ivr_bridge_display(switch_core_session_t *session, switch_core_session_t *peer_session)
+{
+
+ send_display(session, peer_session);
+ send_display(peer_session, session);
+
+}
+
struct switch_ivr_bridge_data {
switch_core_session_t *session;
char b_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
@@ -94,7 +153,7 @@
switch_ivr_bridge_data_t *data = obj;
int stream_id = 0, pre_b = 0, ans_a = 0, ans_b = 0, originator = 0;
switch_input_callback_function_t input_callback;
- switch_core_session_message_t *message, msg = { 0 };
+ switch_core_session_message_t msg = { 0 };
void *user_data;
switch_channel_t *chan_a, *chan_b;
switch_frame_t *read_frame;
@@ -108,6 +167,11 @@
int16_t silence_data[SWITCH_RECOMMENDED_BUFFER_SIZE/2] = { 0 };
const char *silence_var, *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
struct vid_helper vh = { 0 };
uint32_t vid_launch = 0;
@@ -127,14 +191,23 @@
chan_b = switch_core_session_get_channel(session_b);
ans_a = switch_channel_test_flag(chan_a, CF_ANSWERED);
- if ((originator = switch_channel_test_flag(chan_a, CF_ORIGINATOR))) {
+
+ if ((originator = switch_channel_test_flag(chan_a, CF_BRIDGE_ORIGINATOR))) {
pre_b = switch_channel_test_flag(chan_a, CF_EARLY_MEDIA);
ans_b = switch_channel_test_flag(chan_b, CF_ANSWERED);
}
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;
+ } else {
+ 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);
@@ -148,14 +221,18 @@
}
if ((var = switch_channel_get_variable(chan_a, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE)) && switch_true(var)) {
+ if (switch_stristr("loopback", switch_channel_get_name(chan_a)) || switch_stristr("loopback", switch_channel_get_name(chan_b))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot bypass media while bridged to a loopback address.\n");
+ } else {
+ switch_channel_set_variable(chan_a, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE, NULL);
+ }
bypass_media_after_bridge = 1;
- switch_channel_set_variable(chan_a, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE, NULL);
}
- if ((silence_var = switch_channel_get_variable(chan_a, "bridge_generate_comfort_noise"))) {
+ 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)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Channel has no media!\n");
goto end_of_bridge_loop;
@@ -220,7 +297,7 @@
goto end_of_bridge_loop;
}
- if (loop_count > DEFAULT_LEAD_FRAMES && switch_core_session_private_event_count(session_a)) {
+ if (loop_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a) && switch_core_session_private_event_count(session_a)) {
switch_channel_set_flag(chan_b, CF_SUSPEND);
msg.string_arg = data->b_uuid;
msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
@@ -233,6 +310,8 @@
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
}
+ switch_ivr_parse_all_messages(session_a);
+
if (!inner_bridge && (switch_channel_test_flag(chan_a, CF_SUSPEND) || switch_channel_test_flag(chan_b, CF_SUSPEND))) {
status = switch_core_session_read_frame(session_a, &read_frame, SWITCH_IO_FLAG_NONE, stream_id);
@@ -250,7 +329,8 @@
}
#endif
- if (loop_count > DEFAULT_LEAD_FRAMES && bypass_media_after_bridge && switch_channel_test_flag(chan_a, 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_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;
@@ -291,18 +371,15 @@
}
- if (switch_core_session_dequeue_message(session_b, &message) == SWITCH_STATUS_SUCCESS) {
- switch_core_session_receive_message(session_a, message);
- if (switch_test_flag(message, SCSMF_DYNAMIC)) {
- switch_safe_free(message);
- } else {
- message = NULL;
- }
+ if (!ans_a && answer_limit && switch_epoch_time_now(NULL) > answer_limit) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Answer timeout hit on %s.\n", switch_channel_get_name(chan_a));
+ switch_channel_hangup(chan_a, SWITCH_CAUSE_ALLOTTED_TIMEOUT);
}
if (!ans_a && originator) {
if (!ans_b && switch_channel_test_flag(chan_b, CF_ANSWERED)) {
+ switch_channel_pass_callee_id(chan_b, chan_a);
if (switch_channel_answer(chan_a) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(chan_a));
goto end_of_bridge_loop;
@@ -325,15 +402,20 @@
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) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(un));
goto end_of_bridge_loop;
}
-
- 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)) {
@@ -400,7 +482,7 @@
hook_var = switch_channel_get_variable(chan_a, SWITCH_API_BRIDGE_END_VARIABLE);
}
- if (!switch_strlen_zero(hook_var)) {
+ if (!zstr(hook_var)) {
switch_stream_handle_t stream = { 0 };
char *cmd = switch_core_session_strdup(session_a, hook_var);
char *arg = NULL;
@@ -461,8 +543,10 @@
int argc;
char *argv[4] = { 0 };
char *mydata;
-
- if (!switch_strlen_zero(where) && (mydata = switch_core_session_strdup(session, where))) {
+
+ switch_channel_set_variable(switch_core_session_get_channel(session), SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, NULL);
+
+ if (!zstr(where) && (mydata = switch_core_session_strdup(session, where))) {
if ((argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
} else {
@@ -498,7 +582,8 @@
} 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) && bd && !bd->clean_exit
+ 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)) {
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
}
@@ -566,7 +651,7 @@
switch_channel_clear_flag(channel, CF_ORIGINATING);
- if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
+ if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
switch_channel_set_state(channel, CS_SOFT_EXECUTE);
}
@@ -588,11 +673,11 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM SOFT_EXECUTE\n", switch_channel_get_name(channel));
switch_channel_clear_state_handler(channel, &uuid_bridge_state_handlers);
- if (!switch_channel_test_flag(channel, CF_ORIGINATOR)) {
+ if (!switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
return SWITCH_STATUS_SUCCESS;
}
- switch_channel_clear_flag(channel, CF_ORIGINATOR);
+ switch_channel_clear_flag(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);
@@ -700,22 +785,35 @@
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);
+ const char *var;
- if (!switch_strlen_zero(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_hangup(other_channel, switch_channel_get_cause(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));
+ } else {
+ switch_channel_set_state(other_channel, CS_EXECUTE);
+ }
}
}
switch_core_session_rwunlock(other_session);
}
- if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
- switch_channel_clear_flag(channel, CF_ORIGINATOR);
+ if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
+ switch_channel_clear_flag(channel, CF_BRIDGE_ORIGINATOR);
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
@@ -755,7 +853,7 @@
switch_channel_set_variable(caller_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, switch_core_session_get_uuid(peer_session));
switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, switch_core_session_get_uuid(session));
- switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
+ switch_channel_set_flag(caller_channel, CF_BRIDGE_ORIGINATOR);
switch_channel_clear_state_handler(caller_channel, NULL);
switch_channel_clear_state_handler(peer_channel, NULL);
@@ -794,6 +892,8 @@
switch_channel_set_flag(peer_channel, CF_TRANSFER);
}
+ switch_ivr_bridge_display(session, peer_session);
+
return SWITCH_STATUS_SUCCESS;
}
@@ -815,7 +915,12 @@
const char *var;
switch_call_cause_t cause;
- switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
+ if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)) {
+ 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(caller_channel, CF_BRIDGE_ORIGINATOR);
b_leg->session = peer_session;
switch_copy_string(b_leg->b_uuid, switch_core_session_get_uuid(session), sizeof(b_leg->b_uuid));
@@ -834,6 +939,7 @@
switch_channel_add_state_handler(peer_channel, &audio_bridge_peer_state_handlers);
if (switch_channel_test_flag(peer_channel, CF_ANSWERED) && !switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
+ switch_channel_pass_callee_id(peer_channel, caller_channel);
switch_channel_answer(caller_channel);
}
@@ -940,7 +1046,7 @@
switch_channel_set_state(peer_channel, CS_EXCHANGE_MEDIA);
audio_bridge_thread(NULL, (void *) a_leg);
- switch_channel_clear_flag(caller_channel, CF_ORIGINATOR);
+ switch_channel_clear_flag(caller_channel, CF_BRIDGE_ORIGINATOR);
while (switch_channel_get_state(peer_channel) == CS_EXCHANGE_MEDIA) {
switch_cond_next();
@@ -1004,8 +1110,8 @@
state = switch_channel_get_state(caller_channel);
- if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && !switch_channel_test_flag(caller_channel, CF_REDIRECT)
- && !a_leg->clean_exit && !inner_bridge) {
+ 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)) {
if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {
@@ -1041,7 +1147,7 @@
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 (!switch_strlen_zero(sbv) && (sbsession = switch_core_session_locate(sbv))) {
+ 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);
switch_core_session_rwunlock(sbsession);
@@ -1060,8 +1166,7 @@
switch_core_session_t *originator_session, *originatee_session, *swap_session;
switch_channel_t *originator_channel, *originatee_channel, *swap_channel;
switch_status_t status = SWITCH_STATUS_FALSE;
- switch_caller_profile_t *cp, *originator_cp, *originatee_cp;
- char *p;
+ switch_caller_profile_t *originator_cp, *originatee_cp;
switch_channel_state_t state;
if ((originator_session = switch_core_session_locate(originator_uuid))) {
@@ -1129,26 +1234,8 @@
switch_channel_set_variable(originator_channel, "original_caller_id_name", originator_cp->caller_id_name);
switch_channel_set_variable(originator_channel, "original_caller_id_number", originator_cp->caller_id_number);
- cp = switch_caller_profile_clone(originatee_session, originatee_cp);
- cp->destination_number = switch_core_strdup(cp->pool, originator_cp->caller_id_number);
- cp->caller_id_number = switch_core_strdup(cp->pool, originator_cp->caller_id_number);
- cp->caller_id_name = switch_core_strdup(cp->pool, originator_cp->caller_id_name);
- cp->rdnis = switch_core_strdup(cp->pool, originatee_cp->destination_number);
- if ((p = strchr(cp->rdnis, '@'))) {
- *p = '\0';
- }
- switch_channel_set_caller_profile(originatee_channel, cp);
+
switch_channel_set_originator_caller_profile(originatee_channel, switch_caller_profile_clone(originatee_session, originator_cp));
-
- cp = switch_caller_profile_clone(originator_session, originator_cp);
- cp->destination_number = switch_core_strdup(cp->pool, originatee_cp->caller_id_number);
- cp->caller_id_number = switch_core_strdup(cp->pool, originatee_cp->caller_id_number);
- cp->caller_id_name = switch_core_strdup(cp->pool, originatee_cp->caller_id_name);
- cp->rdnis = switch_core_strdup(cp->pool, originator_cp->destination_number);
- if ((p = strchr(cp->rdnis, '@'))) {
- *p = '\0';
- }
- switch_channel_set_caller_profile(originator_channel, cp);
switch_channel_set_originatee_caller_profile(originator_channel, switch_caller_profile_clone(originator_session, originatee_cp));
switch_channel_stop_broadcast(originator_channel);
@@ -1162,10 +1249,13 @@
switch_channel_clear_flag(originatee_channel, CF_ORIGINATING);
/* change the states and let the chips fall where they may */
+
+ switch_channel_set_variable(originator_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE, NULL);
+ switch_channel_set_variable(originatee_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE, NULL);
switch_channel_clear_state_handler(originator_channel, NULL);
switch_channel_clear_state_handler(originatee_channel, NULL);
- switch_channel_set_state_flag(originator_channel, CF_ORIGINATOR);
- switch_channel_clear_flag(originatee_channel, CF_ORIGINATOR);
+ switch_channel_set_state_flag(originator_channel, CF_BRIDGE_ORIGINATOR);
+ switch_channel_clear_flag(originatee_channel, CF_BRIDGE_ORIGINATOR);
switch_channel_add_state_handler(originator_channel, &uuid_bridge_state_handlers);
switch_channel_add_state_handler(originatee_channel, &uuid_bridge_state_handlers);
@@ -1176,6 +1266,8 @@
status = SWITCH_STATUS_SUCCESS;
+ switch_ivr_bridge_display(originator_session, originatee_session);
+
/* release the read locks we have on the channels */
switch_core_session_rwunlock(originator_session);
switch_core_session_rwunlock(originatee_session);
@@ -1229,7 +1321,7 @@
}
}
- if (switch_strlen_zero(uuid) || !(rsession = switch_core_session_locate(uuid))) {
+ if (zstr(uuid) || !(rsession = switch_core_session_locate(uuid))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no uuid %s\n", uuid);
return;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_menu.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_menu.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_menu.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -140,35 +140,35 @@
inter_timeout = timeout / 2;
}
- if (!switch_strlen_zero(name)) {
+ if (!zstr(name)) {
menu->name = switch_core_strdup(menu->pool, name);
}
- if (!switch_strlen_zero(greeting_sound)) {
+ if (!zstr(greeting_sound)) {
menu->greeting_sound = switch_core_strdup(menu->pool, greeting_sound);
}
- if (!switch_strlen_zero(short_greeting_sound)) {
+ if (!zstr(short_greeting_sound)) {
menu->short_greeting_sound = switch_core_strdup(menu->pool, short_greeting_sound);
}
- if (!switch_strlen_zero(invalid_sound)) {
+ if (!zstr(invalid_sound)) {
menu->invalid_sound = switch_core_strdup(menu->pool, invalid_sound);
}
- if (!switch_strlen_zero(exit_sound)) {
+ if (!zstr(exit_sound)) {
menu->exit_sound = switch_core_strdup(menu->pool, exit_sound);
}
- if (!switch_strlen_zero(confirm_macro)) {
+ if (!zstr(confirm_macro)) {
menu->confirm_macro = switch_core_strdup(menu->pool, confirm_macro);
}
- if (!switch_strlen_zero(tts_engine)) {
+ if (!zstr(tts_engine)) {
menu->tts_engine = switch_core_strdup(menu->pool, tts_engine);
}
- if (!switch_strlen_zero(tts_voice)) {
+ if (!zstr(tts_voice)) {
menu->tts_voice = switch_core_strdup(menu->pool, tts_voice);
}
@@ -294,7 +294,7 @@
char *sound_expanded = sound;
switch_size_t menu_buf_len = 0;
- if (!session || !menu || switch_strlen_zero(sound)) {
+ if (!session || !menu || zstr(sound)) {
return status;
}
@@ -396,7 +396,7 @@
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
- if (!session || !stack || switch_strlen_zero(name)) {
+ if (!session || !stack || zstr(name)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid menu context\n");
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
@@ -408,7 +408,7 @@
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
- if (!switch_strlen_zero(menu->tts_engine) && !switch_strlen_zero(menu->tts_voice)) {
+ if (!zstr(menu->tts_engine) && !zstr(menu->tts_voice)) {
switch_channel_set_variable(channel, "tts_engine", menu->tts_engine);
switch_channel_set_variable(channel, "tts_voice", menu->tts_voice);
}
@@ -456,7 +456,7 @@
char substituted[1024];
char *use_arg = ap->arg;
- if (!switch_strlen_zero(menu->tts_engine) && !switch_strlen_zero(menu->tts_voice)) {
+ if (!zstr(menu->tts_engine) && !zstr(menu->tts_voice)) {
switch_channel_set_variable(channel, "tts_engine", menu->tts_engine);
switch_channel_set_variable(channel, "tts_voice", menu->tts_voice);
}
@@ -516,7 +516,7 @@
status = SWITCH_STATUS_FALSE;
- if (!switch_strlen_zero(aptr)) {
+ if (!zstr(aptr)) {
app_name = switch_core_session_strdup(session, aptr);
if ((app_arg = strchr(app_name, ' '))) {
*app_arg++ = '\0';
@@ -579,7 +579,7 @@
if (stack->stack_count == 1) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "exit-sound '%s'\n", menu->exit_sound);
- if (!switch_strlen_zero(menu->exit_sound)) {
+ if (!zstr(menu->exit_sound)) {
status = play_and_collect(session, menu, menu->exit_sound, 0);
}
}
@@ -669,7 +669,7 @@
{
int i;
- if (!switch_strlen_zero(action_name)) {
+ if (!zstr(action_name)) {
for(i = 0;;i++) {
if (!iam[i].name) {
break;
@@ -689,7 +689,7 @@
{
int i;
- if (!switch_strlen_zero(action)) {
+ if (!zstr(action)) {
for(i = 0;;i++) {
if (!iam[i].name) {
break;
@@ -770,7 +770,7 @@
switch_ivr_menu_t *menu = NULL;
- if (switch_strlen_zero(max_timeouts)) {
+ if (zstr(max_timeouts)) {
max_timeouts = max_failures;
}
@@ -812,7 +812,7 @@
const char *digits = switch_xml_attr(xml_kvp, "digits");
const char *param = switch_xml_attr_soft(xml_kvp, "param");
- if (is_valid_action(action) && !switch_strlen_zero(digits)) {
+ if (is_valid_action(action) && !zstr(digits)) {
switch_ivr_menu_xml_map_t *xml_map = xml_menu_ctx->map;
int found = 0;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_originate.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_originate.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_originate.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -113,11 +113,15 @@
int monitor_early_media_ring_count;
int monitor_early_media_ring_total;
int cancel_timeout;
+ int continue_on_timeout;
+ int ringback_ok;
+ int sending_ringback;
} originate_global_t;
typedef enum {
+ IDX_KEY_CANCEL = -4,
IDX_TIMEOUT = -3,
IDX_CANCEL = -2,
IDX_NADA = -1
@@ -229,17 +233,62 @@
int max,
time_t start)
{
- int x = 0,i;
+ 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;
if (oglobals->cancel_timeout > 0) {
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 &&
+ switch_channel_get_state(originate_status[i].peer_channel) != CS_REPORTING) {
+ if (originate_status[i].per_channel_delay_start) {
+ delayed_channels++;
+ } else {
+ active_channels++;
+ }
+ }
+ }
+ 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) ) {
+ 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) {
- switch_channel_clear_flag(originate_status[i].peer_channel, CF_BLOCK_STATE);
- originate_status[i].per_channel_delay_start = 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) {
+ /* IN theory this check is not needed ( should just be if !0 then -= with no else), if its not 0 it should always be greater.... */
+ originate_status[i].per_channel_timelimit_sec -= early_exit_time;
+ } else {
+ originate_status[i].per_channel_timelimit_sec = 1;
+ }
+ }
+ if (originate_status[i].per_channel_progress_timelimit_sec) {
+ if (originate_status[i].per_channel_progress_timelimit_sec > early_exit_time) {
+ /* IN theory this check is not needed ( should just be if !0 then -= with no else), if its not 0 it should always be greater.... */
+ originate_status[i].per_channel_progress_timelimit_sec -= early_exit_time;
+ } else {
+ originate_status[i].per_channel_progress_timelimit_sec = 1;
+ }
+ }
+ originate_status[i].per_channel_delay_start -= delayed_min;
+ } else {
+ originate_status[i].per_channel_delay_start = 0;
+ }
+
+ 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)) {
@@ -317,6 +366,7 @@
switch_channel_t *caller_channel = NULL;
int pindex = -1;
char bug_key[256] = "";
+ int send_ringback = 0;
oglobals->hups = 0;
oglobals->idx = IDX_NADA;
@@ -324,6 +374,9 @@
if (oglobals->session) {
caller_channel = switch_core_session_get_channel(oglobals->session);
+ if (switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE)) {
+ caller_channel = NULL;
+ }
}
@@ -339,12 +392,34 @@
originate_status[i].ring_ready = 1;
}
- if (!oglobals->ring_ready) {
- oglobals->ring_ready = 1;
+ if (oglobals->sending_ringback == 1) {
+ send_ringback++;
+ pindex = (uint32_t) i;
+ } else {
+ if (!oglobals->ring_ready) {
+ oglobals->ring_ready = 1;
+ if (caller_channel && !oglobals->ignore_ring_ready) {
+ if (len == 1) {
+ switch_channel_pass_callee_id(originate_status[0].peer_channel, caller_channel);
+ }
+ switch_channel_ring_ready(caller_channel);
+ oglobals->sent_ring = 1;
+ }
+ }
}
}
if (switch_channel_test_flag(originate_status[i].peer_channel, CF_EARLY_MEDIA)) {
+
+ if (oglobals->sending_ringback == 1) {
+ send_ringback++;
+ pindex = (uint32_t) i;
+ } else if (!oglobals->sent_ring && oglobals->ignore_early_media == 2 && len == 1 && caller_channel && !oglobals->ignore_ring_ready) {
+ switch_channel_pass_callee_id(originate_status[0].peer_channel, caller_channel);
+ switch_channel_ring_ready(caller_channel);
+ oglobals->sent_ring = 1;
+ }
+
if (!originate_status[i].early_media) {
originate_status[i].early_media = 1;
if (oglobals->early_ok) {
@@ -353,7 +428,7 @@
if (oglobals->monitor_early_media_fail) {
const char *var = switch_channel_get_variable(originate_status[i].peer_channel, "monitor_early_media_fail");
- if (!switch_strlen_zero(var)) {
+ if (!zstr(var)) {
char *fail_array[128] = {0};
int fail_count = 0;
char *fail_data = strdup(var);
@@ -420,7 +495,7 @@
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 (!switch_strlen_zero(var)) {
+ if (!zstr(var)) {
char *ring_array[128] = {0};
int ring_count = 0;
char *ring_data = strdup(var);
@@ -471,12 +546,13 @@
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_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);
}
@@ -491,13 +567,12 @@
if (!oglobals->ring_ready && !oglobals->ignore_ring_ready) {
oglobals->ring_ready = 1;
+
}
}
}
- if (switch_core_session_private_event_count(originate_status[i].peer_session)) {
- switch_ivr_parse_all_events(originate_status[i].peer_session);
- }
+ 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) ||
@@ -514,7 +589,7 @@
&& !switch_channel_test_flag(originate_status[i].peer_channel, CF_TAGGED)
) {
- if (!switch_strlen_zero(oglobals->key)) {
+ if (!zstr(oglobals->key)) {
struct key_collect *collect;
if (oglobals->cancel_timeout < 0) {
@@ -523,10 +598,10 @@
if ((collect = switch_core_session_alloc(originate_status[i].peer_session, sizeof(*collect)))) {
switch_channel_set_flag(originate_status[i].peer_channel, CF_TAGGED);
- if (!switch_strlen_zero(oglobals->key)) {
+ if (!zstr(oglobals->key)) {
collect->key = switch_core_session_strdup(originate_status[i].peer_session, oglobals->key);
}
- if (!switch_strlen_zero(oglobals->file)) {
+ if (!zstr(oglobals->file)) {
collect->file = switch_core_session_strdup(originate_status[i].peer_session, oglobals->file);
}
switch_channel_audio_sync(originate_status[i].peer_channel);
@@ -566,16 +641,21 @@
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_channel_get_name(caller_channel), tmp);
+ 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));
}
}
}
-
+ if (send_ringback) {
+ oglobals->sending_ringback++;
+ }
+
return rval;
}
@@ -616,16 +696,20 @@
switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
uint8_t pass = 0;
ringback_t ringback = { 0 };
- switch_core_session_message_t *message = NULL;
switch_frame_t *read_frame = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
int timelimit = 60;
const char *var;
switch_time_t start = 0;
const char *cancel_key = NULL;
+ 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);
+ }
+
if (session) {
caller_channel = switch_core_session_get_channel(session);
}
@@ -660,7 +744,7 @@
if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) || switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)) {
ringback_data = NULL;
- } else if (switch_strlen_zero(ringback_data)) {
+ } else if (zstr(ringback_data)) {
if ((var = switch_channel_get_variable(caller_channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE))) {
int sval = atoi(var);
@@ -682,7 +766,7 @@
if (!ringback.asis) {
- if (!(pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) {
+ if ((pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) {
goto no_ringback;
}
@@ -711,7 +795,11 @@
switch_core_session_set_read_codec(session, &write_codec);
}
}
-
+
+ if (switch_channel_test_flag(caller_channel, CF_DISABLE_RINGBACK)) {
+ ringback_data = NULL;
+ }
+
if (ringback_data) {
char *tmp_data = NULL;
@@ -772,8 +860,11 @@
no_ringback:
- while (switch_channel_ready(peer_channel)
- && !(switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
+ if (caller_channel) {
+ wait_state = switch_channel_get_state(caller_channel);
+ }
+
+ while (switch_channel_ready(peer_channel) && !switch_channel_media_ready(peer_channel)) {
int diff = (int) (switch_micro_time_now() - start);
if (caller_channel && cancel_key) {
@@ -788,20 +879,15 @@
}
}
+ if (caller_channel && switch_channel_get_state(caller_channel) != wait_state) {
+ goto done;
+ }
+
if (diff > timelimit) {
status = SWITCH_STATUS_TIMEOUT;
goto done;
}
-
- if (switch_core_session_dequeue_message(peer_session, &message) == SWITCH_STATUS_SUCCESS) {
- if (switch_test_flag(message, SCSMF_DYNAMIC)) {
- switch_safe_free(message);
- } else {
- message = NULL;
- }
- }
-
if (switch_channel_media_ready(caller_channel)) {
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
@@ -880,7 +966,18 @@
end:
- return (!caller_channel || switch_channel_ready(caller_channel)) ? status : SWITCH_STATUS_FALSE;
+ if (!switch_channel_media_ready(peer_channel)) {
+ if (switch_channel_up(peer_channel)) {
+ switch_channel_hangup(peer_channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ }
+ status = SWITCH_STATUS_FALSE;
+ }
+
+ if (caller_channel && !switch_channel_ready(caller_channel)) {
+ status = SWITCH_STATUS_FALSE;
+ }
+
+ return status;
}
SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname)
@@ -907,6 +1004,143 @@
}
+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_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 (!(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_channel_get_name(caller_channel));
+ switch_goto_status(SWITCH_STATUS_GENERR, end);
+ }
+
+ if (switch_core_codec_init(write_codec,
+ "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(oglobals->session)) == SWITCH_STATUS_SUCCESS) {
+
+
+ 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);
+ write_frame->codec = write_codec;
+ write_frame->datalen = read_codec->implementation->decoded_bytes_per_packet;
+ write_frame->samples = write_frame->datalen / 2;
+ memset(write_frame->data, 255, write_frame->datalen);
+ switch_core_session_set_read_codec(oglobals->session, write_codec);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_ERROR, "Codec Error!\n");
+ switch_channel_hangup(caller_channel, SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE);
+ read_codec = NULL;
+ switch_goto_status(SWITCH_STATUS_BREAK, end);
+ }
+ }
+
+ oglobals->gen_ringback = 1;
+
+ if (switch_is_file_path(ringback_data)) {
+ char *ext;
+
+ if (ringback->asis) {
+ write_frame->codec = read_codec;
+ ext = read_codec->implementation->iananame;
+ tmp_data = switch_mprintf("%s.%s", ringback_data, ext);
+ ringback_data = tmp_data;
+ }
+
+ 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,
+ ringback_data,
+ read_codec->implementation->number_of_channels,
+ read_codec->implementation->actual_samples_per_second,
+ SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing File\n");
+ switch_safe_free(tmp_data);
+ switch_goto_status(SWITCH_STATUS_GENERR, end);
+ //switch_goto_status(SWITCH_STATUS_FALSE, end);
+ }
+ ringback->fh = &ringback->fhb;
+
+ } else if (!strncasecmp(ringback_data, "silence", 7)) {
+ const char *c = ringback_data + 7;
+ if (*c == ':') {
+ c++;
+ if (c) {
+ ringback->silence = atoi(c);
+ }
+ }
+ if (ringback->silence <= 0) {
+ ringback->silence = 400;
+ }
+ } 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_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);
+ switch_buffer_destroy(&ringback->audio_buffer);
+ switch_goto_status(SWITCH_STATUS_GENERR, end);
+ }
+ }
+ }
+
+ end:
+
+ switch_safe_free(tmp_data);
+
+ return status;
+
+}
+
+
+#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) || \
+ switch_channel_get_state(_peer) == CS_RESET || \
+ !switch_channel_test_flag(_peer, CF_ORIGINATING)))
+
#define MAX_PEERS 128
SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *session,
switch_core_session_t **bleg,
@@ -940,16 +1174,14 @@
int32_t sleep_ms = 1000, try = 0, retries = 1;
switch_codec_t write_codec = { 0 };
switch_frame_t write_frame = { 0 };
- uint8_t pass = 0;
char *odata, *var;
switch_call_cause_t reason = SWITCH_CAUSE_NONE;
+ switch_call_cause_t force_reason = SWITCH_CAUSE_NONE;
uint8_t to = 0;
char *var_val, *vars = NULL;
int var_block_count = 0;
char *e = NULL;
const char *ringback_data = NULL;
- switch_codec_t *read_codec = NULL;
- switch_core_session_message_t *message = NULL;
switch_event_t *var_event = NULL;
uint8_t fail_on_single_reject = 0;
char *fail_on_single_reject_var = NULL;
@@ -960,12 +1192,55 @@
int cdr_total = 0;
int local_clobber = 0;
const char *cancel_key = NULL;
+ const char *holding = NULL;
+ oglobals.ringback_ok = 1;
+
+ if (session) {
+ const char *to_var;
+ caller_channel = switch_core_session_get_channel(session);
+ switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
+ oglobals.session = session;
+
+
+ if ((to_var = switch_channel_get_variable(caller_channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
+ 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);
+ }
+
+ 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)) {
+ 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);
+ }
+ }
+ }
+ }
+
+ if (timelimit_sec <= 0) {
+ timelimit_sec = 60;
+ }
+
+
oglobals.idx = IDX_NADA;
oglobals.early_ok = 1;
- oglobals.session = session;
+
*bleg = NULL;
switch_zmalloc(write_frame.data, SWITCH_RECOMMENDED_BUFFER_SIZE);
@@ -1028,7 +1303,7 @@
data++;
}
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "No origination URL specified!\n");
status = SWITCH_STATUS_GENERR;
goto done;
@@ -1069,8 +1344,6 @@
switch_event_header_t *hi;
const char *cdr_total_var;
- caller_channel = switch_core_session_get_channel(oglobals.session);
-
if ((cdr_total_var = switch_channel_get_variable(caller_channel, "failed_xml_cdr_total"))) {
int tmp = atoi(cdr_total_var);
if (tmp > 0) {
@@ -1095,6 +1368,8 @@
ok = 1;
} else if (!strcasecmp((char *) hi->name, "ignore_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")) {
ok = 1;
} else if (!strcasecmp((char *) hi->name, "monitor_early_media_ring")) {
@@ -1148,7 +1423,7 @@
if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) || switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)) {
ringback_data = NULL;
- } else if (switch_strlen_zero(ringback_data)) {
+ } else if (zstr(ringback_data)) {
const char *vvar;
if ((vvar = switch_channel_get_variable(caller_channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE))) {
@@ -1162,9 +1437,12 @@
}
}
+#if 0
+ /* changing behaviour ignore_early_media=true must also be explicitly set for previous behaviour */
if (ringback_data) {
oglobals.early_ok = 0;
}
+#endif
if (switch_true(switch_event_get_header(var_event, "group_confirm_cancel_timeout"))) {
oglobals.cancel_timeout = -1;
@@ -1190,11 +1468,20 @@
*oglobals.file = '\0';
}
- if ((var_val = switch_event_get_header(var_event, "ignore_early_media")) && switch_true(var_val)) {
- oglobals.early_ok = 0;
- oglobals.ignore_early_media = 1;
+ if ((var_val = switch_event_get_header(var_event, "ignore_early_media"))) {
+ if (switch_true(var_val)) {
+ oglobals.early_ok = 0;
+ oglobals.ignore_early_media = 1;
+ } else if (!strcmp(var_val, "ring_ready")) {
+ oglobals.early_ok = 0;
+ oglobals.ignore_early_media = 2;
+ }
}
+ if ((var_val = switch_event_get_header(var_event, "originate_continue_on_timeout")) && switch_true(var_val)) {
+ oglobals.continue_on_timeout = 1;
+ }
+
if ((var_val = switch_event_get_header(var_event, "ignore_ring_ready")) && switch_true(var_val)) {
oglobals.ignore_ring_ready = 1;
}
@@ -1317,7 +1604,7 @@
start = 0;
read_frame = NULL;
pool = NULL;
- pass = 0;
+ oglobals.ringback_ok = 1;
var = NULL;
to = 0;
oglobals.sent_ring = 0;
@@ -1614,6 +1901,14 @@
if (originate_status[i].peer_channel) {
const char *vvar;
+ 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);
+ }
+
+ if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "origination_callee_id_number"))) {
+ switch_channel_set_profile_var(originate_status[i].peer_channel, "callee_id_number", vvar);
+ }
+
if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "leg_timeout"))) {
int val = atoi(vvar);
if (val > 0) {
@@ -1638,18 +1933,24 @@
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;
+
+ if (originate_status[i].per_channel_progress_timelimit_sec != 0) {
+ originate_status[i].per_channel_progress_timelimit_sec += originate_status[i].per_channel_delay_start;
+ }
+
+ if (originate_status[i].per_channel_timelimit_sec != 0) {
+ originate_status[i].per_channel_timelimit_sec += originate_status[i].per_channel_delay_start;
+ }
}
}
}
- if (!table) {
- table = &originate_state_handlers;
- }
-
if (table) {
switch_channel_add_state_handler(originate_status[i].peer_channel, table);
}
+ switch_channel_add_state_handler(originate_status[i].peer_channel, &originate_state_handlers);
+
if ((flags & SOF_NOBLOCK) && originate_status[i].peer_session) {
status = SWITCH_STATUS_SUCCESS;
*bleg = originate_status[i].peer_session;
@@ -1701,7 +2002,8 @@
goto notready;
}
- if (!oglobals.sent_ring && !oglobals.progress && (progress_timelimit_sec && elapsed > (time_t) progress_timelimit_sec)) {
+ if (!oglobals.sent_ring && !oglobals.ignore_ring_ready &&
+ !oglobals.progress && (progress_timelimit_sec && elapsed > (time_t) progress_timelimit_sec)) {
to++;
oglobals.idx = IDX_TIMEOUT;
goto notready;
@@ -1723,138 +2025,34 @@
endfor1:
if (caller_channel) {
- if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) || switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)) {
+ 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 (ringback_data && !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_channel_get_name(caller_channel));
- goto done;
- }
- }
-
- if (oglobals.session && (read_codec = switch_core_session_get_read_codec(oglobals.session)) && ringback_data) {
- if (switch_is_file_path(ringback_data)) {
- if (!(strrchr(ringback_data, '.') || strstr(ringback_data, SWITCH_URL_SEPARATOR))) {
- ringback.asis++;
- }
- }
-
- if (!ringback.asis) {
- if (!(pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) {
- ringback_data = NULL;
- goto no_ringback;
- }
-
- if (switch_core_codec_init(&write_codec,
- "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(oglobals.session)) == SWITCH_STATUS_SUCCESS) {
-
-
- 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);
- write_frame.codec = &write_codec;
- write_frame.datalen = read_codec->implementation->decoded_bytes_per_packet;
- write_frame.samples = write_frame.datalen / 2;
- memset(write_frame.data, 255, write_frame.datalen);
- switch_core_session_set_read_codec(oglobals.session, &write_codec);
- } else {
- switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_ERROR, "Codec Error!\n");
- switch_channel_hangup(caller_channel, SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE);
- read_codec = NULL;
- goto done;
- }
- }
-
- if (ringback_data) {
- char *tmp_data = NULL;
-
- oglobals.gen_ringback = 1;
-
- if (switch_is_file_path(ringback_data)) {
- char *ext;
-
- if (ringback.asis) {
- write_frame.codec = read_codec;
- ext = read_codec->implementation->iananame;
- tmp_data = switch_mprintf("%s.%s", ringback_data, ext);
- ringback_data = tmp_data;
- }
-
- 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,
- ringback_data,
- read_codec->implementation->number_of_channels,
- read_codec->implementation->actual_samples_per_second,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing File\n");
- switch_safe_free(tmp_data);
- goto notready;
- }
- ringback.fh = &ringback.fhb;
-
- } else if (!strncasecmp(ringback_data, "silence", 7)) {
- const char *c = ringback_data + 7;
- if (*c == ':') {
- c++;
- if (c) {
- ringback.silence = atoi(c);
- }
- }
- if (ringback.silence <= 0) {
- ringback.silence = 400;
- }
- } 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_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);
- switch_buffer_destroy(&ringback.audio_buffer);
- ringback_data = NULL;
- }
- }
- switch_safe_free(tmp_data);
- }
- }
-
- no_ringback:
+#if 0
+ /* changing behaviour ignore_early_media=true must also be explicitly set for previous behaviour */
if (ringback_data) {
oglobals.early_ok = 0;
}
+#endif
- while ((!caller_channel || switch_channel_ready(caller_channel)) && check_channel_status(&oglobals, originate_status, and_argc)) {
+ if (ringback_data) {
+ oglobals.sending_ringback = 1;
+ } else {
+ oglobals.ringback_ok = 0;
+ }
+
+ 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)) {
time_t elapsed = switch_epoch_time_now(NULL) - start;
- if (caller_channel && !oglobals.sent_ring && oglobals.ring_ready && !oglobals.return_ring_ready) {
- switch_channel_ring_ready(caller_channel);
- oglobals.sent_ring = 1;
- }
- /* When the AND operator is being used, and fail_on_single_reject is set, a hangup indicates that the call should fail. */
check_per_channel_timeouts(&oglobals, originate_status, and_argc, start);
- if (oglobals.session && switch_core_session_private_event_count(oglobals.session)) {
+ if (oglobals.session) {
switch_ivr_parse_all_events(oglobals.session);
}
@@ -1876,7 +2074,7 @@
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)) {
@@ -1891,28 +2089,15 @@
goto notready;
}
}
-
- if (originate_status[0].peer_session
- && switch_core_session_dequeue_message(originate_status[0].peer_session, &message) == SWITCH_STATUS_SUCCESS) {
- if (oglobals.session && !ringback_data && or_argc == 1 && and_argc == 1) {
- /* when there is only 1 channel to call and bridge and no ringback */
- switch_core_session_receive_message(oglobals.session, message);
- }
-
- if (switch_test_flag(message, SCSMF_DYNAMIC)) {
- switch_safe_free(message);
- } else {
- message = NULL;
- }
- }
-
+
/* read from the channel while we wait if the audio is up on it */
if (oglobals.session &&
!switch_channel_test_flag(caller_channel, CF_PROXY_MODE) &&
!switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA) &&
- (ringback_data
+ !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;
@@ -1921,7 +2106,7 @@
switch_dtmf_t dtmf = { 0, 0 };
if (switch_channel_dequeue_dtmf(caller_channel, &dtmf) == SWITCH_STATUS_SUCCESS) {
if (dtmf.digit == *cancel_key) {
- oglobals.idx = IDX_CANCEL;
+ oglobals.idx = IDX_KEY_CANCEL;
goto notready;
}
}
@@ -1931,13 +2116,39 @@
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 (switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE)) {
+ continue;
+ }
break;
}
} else {
read_frame = NULL;
}
- if ((oglobals.ring_ready || oglobals.instant_ringback) && read_frame && !pass) {
+ if (oglobals.ringback_ok && (oglobals.ring_ready || oglobals.instant_ringback || oglobals.sending_ringback > 1)) {
+ if (oglobals.ringback_ok == 1) {
+ switch_status_t rst = setup_ringback(&oglobals, ringback_data, &ringback, &write_frame, &write_codec);
+
+ switch (rst) {
+ case SWITCH_STATUS_SUCCESS:
+ oglobals.ringback_ok++;
+ break;
+ case SWITCH_STATUS_FALSE:
+ goto notready;
+ break;
+ case SWITCH_STATUS_BREAK:
+ goto done;
+ break;
+ default:
+ ringback_data = NULL;
+ oglobals.ringback_ok = 0;
+ oglobals.sending_ringback = 0;
+ break;
+ }
+
+ continue;
+ }
+
if (ringback.fh) {
switch_size_t mlen, olen;
unsigned int pos = 0;
@@ -1986,6 +2197,9 @@
}
if (switch_core_session_write_frame(oglobals.session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
+ if (switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE)) {
+ continue;
+ }
break;
}
}
@@ -1998,7 +2212,18 @@
notready:
- if (caller_channel && !switch_channel_ready(caller_channel)) {
+ 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;
+ 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;
}
@@ -2007,24 +2232,145 @@
switch_core_session_reset(oglobals.session, SWITCH_FALSE, SWITCH_TRUE);
}
- for (i = 0; i < and_argc; i++) {
- if (!originate_status[i].peer_channel) {
- continue;
+ if (holding) {
+ if (oglobals.idx > IDX_NADA) {
+ peer_session = originate_status[oglobals.idx].peer_session;
+ peer_channel = originate_status[oglobals.idx].peer_channel;
+ originate_status[oglobals.idx].peer_channel = NULL;
+ } else if (and_argc == 1) {
+ peer_session = originate_status[0].peer_session;
+ peer_channel = originate_status[0].peer_channel;
+ originate_status[0].peer_channel = NULL;
+ } else {
+ for (i = 0; i < and_argc; i++) {
+ if (!peer_eligible(originate_status[i].peer_channel)) {
+ continue;
+ }
+ if (switch_channel_media_ready(originate_status[i].peer_channel)) {
+ peer_session = originate_status[i].peer_session;
+ peer_channel = originate_status[i].peer_channel;
+ originate_status[i].peer_channel = NULL;
+ goto end_search;
+ }
+ }
+ for (i = 0; i < and_argc; i++) {
+ if (!peer_eligible(originate_status[i].peer_channel)) {
+ continue;
+ }
+ if (switch_channel_up(originate_status[i].peer_channel)) {
+ peer_session = originate_status[i].peer_session;
+ peer_channel = originate_status[i].peer_channel;
+ originate_status[i].peer_channel = NULL;
+ break;
+ }
+ }
}
+
+ end_search:
- //switch_channel_clear_flag(originate_status[i].peer_channel, CF_BLOCK_STATE);
+ if (peer_channel && switch_channel_down(peer_channel)) {
+ switch_core_session_rwunlock(peer_session);
+ peer_session = NULL;
+ peer_channel = NULL;
- if (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_get_state(originate_status[i].peer_channel) == CS_RESET ||
- !switch_channel_test_flag(originate_status[i].peer_channel, CF_ORIGINATING)
- ) {
+ }
+
+ 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;
+ const char *dialplan = NULL;
+ switch_core_session_t *holding_session;
+
+ if (caller_channel) {
+ if (zstr(context)) {
+ context = switch_channel_get_variable(caller_channel, "context");
+ }
+ if (zstr(dialplan)) {
+ dialplan = switch_channel_get_variable(caller_channel, "dialplan");
+ }
+ }
+
+ if (zstr(context)) {
+ context = "default";
+ }
+
+ if (zstr(context)) {
+ dialplan = "XML";
+ }
+
+ if ((holding_session = switch_core_session_locate(holding))) {
+ switch_channel_t *holding_channel = switch_core_session_get_channel(holding_session);
+ 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) {
+ switch_channel_restart(holding_channel);
+ }
+ }
+
+ if (mstatus != SWITCH_STATUS_SUCCESS) {
+ if (peer_channel) {
+ dest = switch_channel_get_variable(peer_channel, "destination_number");
+ context = switch_channel_get_variable(peer_channel, "context");
+ dialplan = switch_channel_get_variable(peer_channel, "dialplan");
+ } else if (caller_channel) {
+ dest = switch_channel_get_variable(caller_channel, "destination_number");
+ }
+ if (dest) {
+ switch_ivr_session_transfer(holding_session, dest, dialplan, context);
+ }
+ }
+
+ switch_core_session_rwunlock(holding_session);
+ holding = NULL;
+ holding_session = NULL;
+ }
+
+ if (peer_channel) {
+ switch_channel_hangup(peer_channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
+ switch_core_session_rwunlock(peer_session);
+ }
+ force_reason = SWITCH_CAUSE_ATTENDED_TRANSFER;
+ } else {
+ if (peer_channel && switch_channel_ready(peer_channel)) {
+ force_reason = SWITCH_CAUSE_ATTENDED_TRANSFER;
+ switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(peer_session));
+ oglobals.idx = IDX_NADA;
+ if (caller_channel && switch_channel_up(caller_channel)) {
+ switch_channel_hangup(caller_channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
+ }
+ caller_channel = NULL;
+ oglobals.session = NULL;
+ session = NULL;
+ switch_core_session_rwunlock(peer_session);
+ } else {
+ switch_core_session_t *holding_session;
+
+ if ((holding_session = switch_core_session_locate(holding))) {
+ switch_channel_t *holding_channel = switch_core_session_get_channel(holding_session);
+ if (caller_channel && switch_channel_ready(caller_channel)) {
+ switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(session));
+ } else {
+ switch_channel_hangup(holding_channel, SWITCH_CAUSE_NORMAL_UNSPECIFIED);
+ }
+ switch_core_session_rwunlock(holding_session);
+ }
+ }
+ }
+
+ 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) {
- const char *holding = NULL;
+ holding = NULL;
if (oglobals.idx == IDX_TIMEOUT || to) {
reason = SWITCH_CAUSE_NO_ANSWER;
@@ -2041,19 +2387,19 @@
}
if (switch_channel_up(originate_status[i].peer_channel)) {
if (caller_channel && i == 0) {
- holding = switch_channel_get_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE);
- switch_channel_set_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE, NULL);
- }
- if (holding && oglobals.idx != IDX_TIMEOUT && oglobals.idx != IDX_CANCEL) {
- switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(originate_status[i].peer_session));
- } else {
+ 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_ivr_uuid_bridge(holding, switch_core_session_get_uuid(originate_status[i].peer_session));
+ } else {
switch_channel_hangup(originate_status[i].peer_channel, reason);
}
}
}
}
-
-
+
if (oglobals.idx > IDX_NADA) {
peer_session = originate_status[oglobals.idx].peer_session;
peer_channel = originate_status[oglobals.idx].peer_channel;
@@ -2068,6 +2414,7 @@
if (caller_channel) {
if (switch_channel_test_flag(peer_channel, CF_ANSWERED)) {
+ switch_channel_pass_callee_id(peer_channel, caller_channel);
status = switch_channel_answer(caller_channel);
} else if (switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) {
status = switch_channel_pre_answer(caller_channel);
@@ -2076,7 +2423,8 @@
}
if (status != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(peer_channel), SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(caller_channel));
+ 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);
}
}
@@ -2112,7 +2460,8 @@
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_channel_get_name(peer_channel));
+ 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;
} else {
@@ -2188,6 +2537,8 @@
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals.session), SWITCH_LOG_DEBUG,
"Originate Cancelled by originator termination Cause: %d [%s]\n", *cause, switch_channel_cause2str(*cause));
+ } else if (oglobals.idx == IDX_TIMEOUT) {
+ *cause = SWITCH_CAUSE_NO_ANSWER;
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals.session), SWITCH_LOG_DEBUG,
"Originate Resulted in Error Cause: %d [%s]\n", *cause, switch_channel_cause2str(*cause));
@@ -2264,9 +2615,13 @@
}
}
}
- if (!ok) {
+ if (ok) {
goto outer_for;
}
+
+ if (to && !oglobals.continue_on_timeout) {
+ goto outer_for;
+ }
}
}
}
@@ -2302,7 +2657,16 @@
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);
+ }
+ if (force_reason != SWITCH_CAUSE_NONE) {
+ *cause = force_reason;
+ }
+
return status;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_play_say.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_play_say.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_ivr_play_say.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -274,6 +274,9 @@
if (!strcasecmp(func, "play-file")) {
status = switch_ivr_play_file(session, NULL, odata, args);
+ } else if (!strcasecmp(func, "phrase")) {
+ char *name = (char *) switch_xml_attr_soft(action, "phrase");
+ status = switch_ivr_phrase_macro(session, name, odata, chan_lang, args);
} else if (!strcasecmp(func, "break")) {
done = 1;
/* must allow the switch_safe_free below to execute or we leak - do not break here */
@@ -324,7 +327,7 @@
if (!my_tts_voice) {
my_tts_voice = tts_voice;
}
- if (switch_strlen_zero(tts_engine) || switch_strlen_zero(tts_voice)) {
+ if (zstr(tts_engine) || zstr(tts_voice)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "TTS is not configured\n");
} else {
status = switch_ivr_speak_text(session, my_tts_engine, my_tts_voice, odata, args);
@@ -401,7 +404,7 @@
return SWITCH_STATUS_FALSE;
}
- if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+ if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
}
@@ -480,7 +483,7 @@
}
}
- file = switch_core_session_sprintf(session, "%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file);
+ 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, '.'))) {
ext++;
@@ -510,10 +513,6 @@
asis = 1;
}
- if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
- return SWITCH_STATUS_FALSE;
- }
-
if ((p = switch_channel_get_variable(channel, "RECORD_TITLE"))) {
vval = switch_core_session_strdup(session, p);
switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_TITLE, vval);
@@ -609,9 +608,7 @@
break;
}
- if (switch_core_session_private_event_count(session)) {
- switch_ivr_parse_all_events(session);
- }
+ switch_ivr_parse_all_events(session);
if (start && (switch_epoch_time_now(NULL) - start) > limit) {
break;
@@ -714,10 +711,16 @@
switch_core_codec_destroy(&write_codec);
}
- switch_channel_set_variable_printf(channel, "record_ms", "%d", fh->samples_in / read_impl.samples_per_second);
- switch_channel_set_variable_printf(channel, "record_samples", "%d", fh->samples_in);
+ switch_core_file_close(fh);
- switch_core_file_close(fh);
+ 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));
+
+ }
+
+ switch_channel_set_variable_printf(channel, "record_samples", "%d", fh->samples_out);
+
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
return status;
}
@@ -800,9 +803,7 @@
break;
}
- if (switch_core_session_private_event_count(session)) {
- switch_ivr_parse_all_events(session);
- }
+ switch_ivr_parse_all_events(session);
if (args && (args->input_callback || args->buf || args->buflen)) {
/*
@@ -919,7 +920,7 @@
prefix = switch_channel_get_variable(channel, "sound_prefix");
timer_name = switch_channel_get_variable(channel, "timer_name");
- if (switch_strlen_zero(file) || !switch_channel_media_ready(channel)) {
+ if (zstr(file) || !switch_channel_media_ready(channel)) {
return SWITCH_STATUS_FALSE;
}
@@ -977,21 +978,21 @@
dup = switch_core_session_strdup(session, alt);
engine = dup;
- if (!switch_strlen_zero(engine)) {
+ if (!zstr(engine)) {
if ((voice = strchr(engine, ':'))) {
*voice++ = '\0';
- if (!switch_strlen_zero(voice) && (text = strchr(voice, ':'))) {
+ if (!zstr(voice) && (text = strchr(voice, ':'))) {
*text++ = '\0';
}
}
}
- if (!switch_strlen_zero(engine) && !switch_strlen_zero(voice) && !switch_strlen_zero(text)) {
+ if (!zstr(engine) && !zstr(voice) && !zstr(text)) {
if ((status = switch_ivr_speak_text(session, engine, voice, text, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
continue;
- } else if (!switch_strlen_zero(engine) && !(voice && text)) {
+ } else if (!zstr(engine) && !(voice && text)) {
text = engine;
engine = (char *) switch_channel_get_variable(channel, "tts_engine");
voice = (char *) switch_channel_get_variable(channel, "tts_voice");
@@ -1131,7 +1132,7 @@
codec_name,
NULL,
fh->samplerate,
- interval, fh->channels, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
+ 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);
@@ -1190,9 +1191,7 @@
break;
}
- if (switch_core_session_private_event_count(session)) {
- switch_ivr_parse_all_events(session);
- }
+ switch_ivr_parse_all_events(session);
if (args && (args->input_callback || args->buf || args->buflen)) {
/*
@@ -1428,7 +1427,12 @@
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_ms", "%d", fh->samples_out / read_impl.samples_per_second);
+ 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_samples", "%d", fh->samples_out);
switch_core_file_close(fh);
@@ -1631,7 +1635,7 @@
args.buf = digit_buffer;
args.buflen = (uint32_t) digit_buffer_length;
- if (!switch_strlen_zero(prompt_audio_file) && strcasecmp(prompt_audio_file, "silence")) {
+ if (!zstr(prompt_audio_file) && strcasecmp(prompt_audio_file, "silence")) {
if ((status = switch_ivr_play_file(session, NULL, prompt_audio_file, &args)) == SWITCH_STATUS_BREAK) {
status = SWITCH_STATUS_SUCCESS;
}
@@ -1678,7 +1682,7 @@
*digit_buffer = '\0';
}
- if (var_name && !switch_strlen_zero(digit_buffer)) {
+ if (var_name && !zstr(digit_buffer)) {
switch_channel_set_variable(channel, var_name, digit_buffer);
}
@@ -1713,8 +1717,8 @@
}
if (status == SWITCH_STATUS_SUCCESS) {
- if (!switch_strlen_zero(digit_buffer)) {
- if (switch_strlen_zero(digits_regex)) {
+ if (!zstr(digit_buffer)) {
+ if (zstr(digits_regex)) {
return SWITCH_STATUS_SUCCESS;
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Test Regex [%s][%s]\n", digit_buffer, digits_regex);
@@ -2209,7 +2213,7 @@
moh = switch_channel_get_variable(other_channel, "hold_music");
}
- if (!switch_strlen_zero(moh) && strcasecmp(moh, "silence") && !switch_channel_test_flag(other_channel, CF_BROADCAST)) {
+ if (!zstr(moh) && strcasecmp(moh, "silence") && !switch_channel_test_flag(other_channel, CF_BROADCAST)) {
switch_ivr_broadcast(other_uuid, moh, SMF_ECHO_ALEG | SMF_LOOP);
moh_br++;
}
@@ -2220,7 +2224,7 @@
moh = switch_channel_get_variable(channel, "hold_music");
}
- if (!switch_strlen_zero(moh) && strcasecmp(moh, "silence")) {
+ if (!zstr(moh) && strcasecmp(moh, "silence")) {
switch_ivr_play_file(session, NULL, moh, &args);
} else {
switch_ivr_collect_digits_callback(session, &args, 0, 0);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_loadable_module.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_loadable_module.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_loadable_module.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -960,7 +960,7 @@
{
switch_status_t status;
- if (switch_strlen_zero(mod)) {
+ if (zstr(mod)) {
return SWITCH_STATUS_FALSE;
}
@@ -1166,7 +1166,7 @@
switch_bool_t global = SWITCH_FALSE;
const char *val = switch_xml_attr_soft(ld, "module");
const char *sglobal = switch_xml_attr_soft(ld, "global");
- if (switch_strlen_zero(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) {
+ if (zstr(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
continue;
}
@@ -1189,7 +1189,7 @@
switch_bool_t global = SWITCH_FALSE;
const char *val = switch_xml_attr_soft(ld, "module");
const char *sglobal = switch_xml_attr_soft(ld, "global");
- if (switch_strlen_zero(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) {
+ if (zstr(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
continue;
}
@@ -1230,7 +1230,7 @@
continue;
}
- if (switch_strlen_zero(fname) || (!strstr(fname, ext) && !strstr(fname, EXT))) {
+ if (zstr(fname) || (!strstr(fname, ext) && !strstr(fname, EXT))) {
continue;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_log.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_log.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_log.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -103,12 +103,12 @@
*newnode = *node;
- if (!switch_strlen_zero(node->data)) {
+ if (!zstr(node->data)) {
newnode->data = strdup(node->data);
switch_assert(node->data);
}
- if (!switch_strlen_zero(node->userdata)) {
+ if (!zstr(node->userdata)) {
newnode->userdata = strdup(node->userdata);
switch_assert(node->userdata);
}
@@ -398,7 +398,7 @@
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-Function", funcp);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Line", "%d", line);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Level", "%d", (int) level);
- if (!switch_strlen_zero(userdata)) {
+ if (!zstr(userdata)) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "User-Data", userdata);
}
switch_event_fire(&event);
@@ -458,7 +458,7 @@
node->content = content;
node->timestamp = now;
node->channel = channel;
- node->userdata = !switch_strlen_zero(userdata) ? strdup(userdata) : NULL;
+ node->userdata = !zstr(userdata) ? strdup(userdata) : NULL;
if (switch_queue_trypush(LOG_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
switch_log_node_free(&node);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_nat.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_nat.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_nat.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -69,7 +69,7 @@
if (UPNP_GetExternalIPAddress(nat_globals.urls.controlURL,
nat_globals.data.servicetype,
pub_addr) == UPNPCOMMAND_SUCCESS) {
- if (!strcmp(pub_addr, "0.0.0.0") || switch_strlen_zero_buf(pub_addr)) {
+ 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);
return SWITCH_STATUS_GENERR;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_odbc.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_odbc.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_odbc.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -524,7 +524,7 @@
if (stmt) {
err_str = switch_odbc_handle_get_error(handle, stmt);
- if (!switch_strlen_zero(err_str)) {
+ if (!zstr(err_str)) {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
}
switch_safe_free(err_str);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_pcm.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_pcm.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_pcm.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -515,24 +515,33 @@
}
- 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 */
- 20000, /* number of microseconds per frame */
- 960, /* number of samples per frame */
- 1920, /* number of bytes per frame decompressed */
- 1920, /* 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 = 960;
+ bytes_per_frame = 1920;
+ 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 */
+ 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 */
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_rtp.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_rtp.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_rtp.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -765,7 +765,7 @@
*err = NULL;
- if (switch_strlen_zero(host) || !port) {
+ if (zstr(host) || !port) {
*err = "Address Error";
goto done;
}
@@ -869,7 +869,7 @@
SWITCH_DECLARE(char *) switch_rtp_get_remote_host(switch_rtp_t *rtp_session)
{
- return switch_strlen_zero(rtp_session->remote_host_str) ? "0.0.0.0" : rtp_session->remote_host_str;
+ return zstr(rtp_session->remote_host_str) ? "0.0.0.0" : rtp_session->remote_host_str;
}
SWITCH_DECLARE(switch_port_t) switch_rtp_get_remote_port(switch_rtp_t *rtp_session)
@@ -1138,15 +1138,15 @@
switch_rtp_set_interval(rtp_session, ms_per_packet, samples_per_interval);
rtp_session->conf_samples_per_interval = samples_per_interval;
- if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER) && switch_strlen_zero(timer_name)) {
+ if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER) && zstr(timer_name)) {
timer_name = "soft";
}
- if (!switch_strlen_zero(timer_name) && !strcasecmp(timer_name, "none")) {
+ if (!zstr(timer_name) && !strcasecmp(timer_name, "none")) {
timer_name = NULL;
}
- if (!switch_strlen_zero(timer_name)) {
+ if (!zstr(timer_name)) {
rtp_session->timer_name = switch_core_strdup(pool, timer_name);
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
@@ -1229,7 +1229,7 @@
{
switch_rtp_t *rtp_session = NULL;
- if (switch_strlen_zero(rx_host)) {
+ if (zstr(rx_host)) {
*err = "Missing local host";
goto end;
}
@@ -1239,7 +1239,7 @@
goto end;
}
- if (switch_strlen_zero(tx_host)) {
+ if (zstr(tx_host)) {
*err = "Missing remote host";
goto end;
}
@@ -1528,6 +1528,7 @@
if (flags & SWITCH_RTP_FLAG_AUTOADJ) {
rtp_session->autoadj_window = 20;
rtp_session->autoadj_tally = 0;
+ rtp_flush_read_buffer(rtp_session, SWITCH_RTP_FLUSH_ONCE);
}
}
@@ -1678,6 +1679,20 @@
READ_INC(rtp_session);
if (switch_rtp_ready(rtp_session)) {
+
+ if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_READ)) {
+ switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
+ if (!session) {
+ 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))
+ );
+ }
+ }
+
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK)) {
was_blocking = 1;
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
@@ -1889,26 +1904,73 @@
rtp_flush_read_buffer(rtp_session, SWITCH_RTP_FLUSH_ONCE);
}
- if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && switch_sockaddr_get_port(rtp_session->from_addr)) {
- if (++rtp_session->autoadj_tally >= 10) {
+
+ if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_READ)) {
+ switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
+
+ if (!session) {
+ 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 {
const char *tx_host;
const char *old_host;
- char bufa[30], bufb[30];
+ 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);
- if ((switch_sockaddr_get_port(rtp_session->from_addr) != rtp_session->remote_port) || strcmp(tx_host, old_host)) {
+ 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",
+ switch_channel_get_name(switch_core_session_get_channel(session)),
+ (long)bytes,
+ my_host, switch_sockaddr_get_port(rtp_session->local_addr),
+ 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;
+
+ }
+ } else if (!switch_cmp_addr(rtp_session->from_addr, rtp_session->remote_addr)) {
+ bytes = 0;
+ goto recvfrom;
+
+ }
+ }
+
+ if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && switch_sockaddr_get_port(rtp_session->from_addr)) {
+ if (!switch_cmp_addr(rtp_session->from_addr, rtp_session->remote_addr)) {
+ if (++rtp_session->autoadj_tally >= 10) {
const char *err;
uint32_t old = rtp_session->remote_port;
+ const char *tx_host;
+ const char *old_host;
+ char bufa[30], bufb[30];
- if (!switch_strlen_zero(tx_host) && switch_sockaddr_get_port(rtp_session->from_addr) > 0) {
- 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));
- switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), SWITCH_FALSE, &err);
- switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
- }
+ tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr);
+ old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
+ "Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host,
+ switch_sockaddr_get_port(rtp_session->from_addr));
+ switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), SWITCH_FALSE, &err);
+ switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
}
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Correct ip/port confirmed.\n");
+ switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
}
}
@@ -2695,6 +2757,37 @@
#endif
+ if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_WRITE)) {
+ switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
+
+ if (!session) {
+ switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_WRITE);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n");
+ } else {
+ const char *tx_host;
+ const char *old_host;
+ 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",
+ switch_channel_get_name(switch_core_session_get_channel(session)),
+ (long)bytes,
+ my_host, switch_sockaddr_get_port(rtp_session->local_addr),
+ 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);
+
+ }
+ }
+
+
if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, (void *) send_msg, &bytes) != SWITCH_STATUS_SUCCESS) {
rtp_session->seq--;
ret = -1;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_scheduler.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_scheduler.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_scheduler.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -263,7 +263,7 @@
switch_mutex_lock(globals.task_mutex);
for (tp = globals.task_list; tp; tp = tp->next) {
- if (!switch_strlen_zero(group) && !strcmp(tp->task.group, group)) {
+ if (!zstr(group) && !strcmp(tp->task.group, group)) {
if (switch_test_flag(tp, SSHF_NO_DEL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Attempt made to delete undeletable task #%u (group %s)\n",
tp->task.task_id, group);
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_swig.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_swig.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_swig.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -49,7 +49,7 @@
switch_status_t status;
const char *err = NULL;
- if (switch_strlen_zero(path)) {
+ if (zstr(path)) {
path = NULL;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_time.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_time.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_time.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -233,8 +233,8 @@
while (globals.STARTED == 0) {
do_sleep(100000);
- if (++sanity == 10) {
- break;
+ if (++sanity == 300) {
+ abort();
}
}
@@ -640,11 +640,11 @@
const char *name = switch_xml_attr(x_list, "name");
const char *value= switch_xml_attr(x_list, "value");
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
continue;
}
- if (switch_strlen_zero(value)) {
+ if (zstr(value)) {
continue;
}
@@ -683,7 +683,7 @@
timep = (thetime) / (int64_t) (1000000);
- if (!switch_strlen_zero(tz_name)) {
+ if (!zstr(tz_name)) {
tzdef = switch_lookup_timezone( tz_name );
} else {
/* We set the default timezone to GMT. */
@@ -719,7 +719,7 @@
timep = (thetime) / (int64_t) (1000000);
- if (!switch_strlen_zero(tz_name)) {
+ if (!zstr(tz_name)) {
tzdef = switch_lookup_timezone( tz_name );
} else {
/* We set the default timezone to GMT. */
@@ -730,8 +730,8 @@
if (tzdef) { /* The lookup of the zone may fail. */
tztime( &timep, tzdef, &tm );
tm2switchtime( &tm, &stm );
- switch_strftime_nocheck(date, &retsize, len, switch_strlen_zero(format) ? "%Y-%m-%d %T" : format, &stm);
- if (!switch_strlen_zero_buf(date)) {
+ switch_strftime_nocheck(date, &retsize, len, zstr(format) ? "%Y-%m-%d %T" : format, &stm);
+ if (!zstr_buf(date)) {
return SWITCH_STATUS_SUCCESS;
}
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_utils.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_utils.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_utils.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -181,7 +181,7 @@
node->bits = bits;
node->str = switch_core_strdup(list->pool, cidr_str);
- if (!switch_strlen_zero(token)) {
+ if (!zstr(token)) {
node->token = switch_core_strdup(list->pool, token);
}
@@ -429,7 +429,13 @@
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)
+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";
@@ -439,37 +445,68 @@
unsigned int b = 0, l = 0;
unsigned char in[B64BUFFLEN];
unsigned char out[B64BUFFLEN + 512];
+ char *dupfile = NULL, *ext = NULL;
+ char *newfile = NULL;
+ switch_bool_t rval = SWITCH_FALSE;
+ if (!zstr(file) && !zstr(convert_cmd) && !zstr(convert_ext)) {
+ if ((ext = strrchr(file, '.'))) {
+ dupfile = strdup(file);
+ if ((ext = strrchr(dupfile, '.'))) {
+ *ext++ = '\0';
+ 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);
+ switch_system(cmd, SWITCH_TRUE);
+ file = newfile;
+ }
+
+ switch_safe_free(dupfile);
+ }
+
switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int) switch_epoch_time_now(NULL), rand() & 0xffff);
if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) {
if (file) {
if ((ifd = open(file, O_RDONLY | O_BINARY)) < 1) {
- return SWITCH_FALSE;
+ rval = SWITCH_FALSE;
+ goto end;
}
}
switch_snprintf(buf, B64BUFFLEN, "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"%s\"\n", bound);
if (!write_buf(fd, buf)) {
- return SWITCH_FALSE;
+ rval = SWITCH_FALSE;
+ goto end;
}
- if (headers && !write_buf(fd, headers))
- return SWITCH_FALSE;
+ if (headers && !write_buf(fd, headers)) {
+ rval = SWITCH_FALSE;
+ goto end;
+ }
- if (!write_buf(fd, "\n\n"))
- return SWITCH_FALSE;
+ if (!write_buf(fd, "\n\n")) {
+ rval = SWITCH_FALSE;
+ goto end;
+ }
if (body && switch_stristr("content-type", body)) {
switch_snprintf(buf, B64BUFFLEN, "--%s\n", bound);
} else {
switch_snprintf(buf, B64BUFFLEN, "--%s\nContent-Type: text/plain\n\n", bound);
}
- if (!write_buf(fd, buf))
- return SWITCH_FALSE;
+ if (!write_buf(fd, buf)) {
+ rval = SWITCH_FALSE;
+ goto end;
+ }
if (body) {
if (!write_buf(fd, body)) {
- return SWITCH_FALSE;
+ rval = SWITCH_FALSE;
+ goto end;
}
}
@@ -491,8 +528,10 @@
"Content-Transfer-Encoding: base64\n"
"Content-Description: Sound attachment.\n"
"Content-Disposition: attachment; filename=\"%s\"\n\n", bound, mime_type, stipped_file, stipped_file);
- if (!write_buf(fd, buf))
- return SWITCH_FALSE;
+ if (!write_buf(fd, buf)) {
+ rval = SWITCH_FALSE;
+ goto end;
+ }
while ((ilen = read(ifd, in, B64BUFFLEN))) {
for (x = 0; x < ilen; x++) {
@@ -507,7 +546,7 @@
}
}
if (write(fd, &out, bytes) != bytes) {
- return -1;
+ rval = -1;
} else
bytes = 0;
@@ -521,14 +560,17 @@
out[bytes++] = '=', l += 2;
}
if (write(fd, &out, bytes) != bytes) {
- return -1;
+ rval = -1;
}
}
switch_snprintf(buf, B64BUFFLEN, "\n\n--%s--\n.\n", bound);
- if (!write_buf(fd, buf))
- return SWITCH_FALSE;
+
+ if (!write_buf(fd, buf)) {
+ rval = SWITCH_FALSE;
+ goto end;
+ }
}
if (fd) {
@@ -537,10 +579,15 @@
if (ifd) {
close(ifd);
}
+
+ if (zstr(from)) {
+ from = "freeswitch";
+ }
+
#ifdef WIN32
- switch_snprintf(buf, B64BUFFLEN, "type %s | %s %s %s", filename, runtime.mailer_app, runtime.mailer_app_args, to);
+ switch_snprintf(buf, B64BUFFLEN, "type %s | %s -f %s %s %s", filename, runtime.mailer_app, from, runtime.mailer_app_args, to);
#else
- switch_snprintf(buf, B64BUFFLEN, "/bin/cat %s | %s %s %s", filename, runtime.mailer_app, runtime.mailer_app_args, to);
+ switch_snprintf(buf, B64BUFFLEN, "/bin/cat %s | %s -f %s %s %s", filename, runtime.mailer_app, from, runtime.mailer_app_args, to);
#endif
if (switch_system(buf, SWITCH_TRUE) < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to execute command: %s\n", buf);
@@ -556,12 +603,21 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Emailed data to [%s]\n", to);
}
- return SWITCH_TRUE;
+ rval = SWITCH_TRUE;
+
+ end:
+
+ if (newfile) {
+ unlink(newfile);
+ free(newfile);
+ }
+
+ return rval;
}
SWITCH_DECLARE(switch_bool_t) switch_is_lan_addr(const char *ip)
{
- if (switch_strlen_zero(ip))
+ if (zstr(ip))
return SWITCH_FALSE;
return (strncmp(ip, "10.", 3) &&
@@ -1282,10 +1338,55 @@
#endif
+SWITCH_DECLARE(int) get_addr_int(switch_sockaddr_t *sa)
+{
+ struct sockaddr_in *s = (struct sockaddr_in *)&sa->sa;
+
+ return ntohs((unsigned short)s->sin_addr.s_addr);
+}
+
+
+SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2)
+{
+ struct sockaddr_in *s1;
+ struct sockaddr_in *s2;
+
+ struct sockaddr_in6 *s16;
+ struct sockaddr_in6 *s26;
+
+ struct sockaddr *ss1;
+ struct sockaddr *ss2;
+
+ if (!(sa1 && sa2)) return 0;
+
+ s1 = (struct sockaddr_in *)&sa1->sa;
+ s2 = (struct sockaddr_in *)&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;
+
+ switch (ss1->sa_family) {
+ case AF_INET:
+ return (s1->sin_addr.s_addr == s2->sin_addr.s_addr && s1->sin_port == s2->sin_port);
+ case AF_INET6:
+ return (s16->sin6_addr.s6_addr && s26->sin6_addr.s6_addr &&
+ *s16->sin6_addr.s6_addr == *s26->sin6_addr.s6_addr && s16->sin6_port == s26->sin6_port);
+ }
+
+ return 0;
+}
+
+
SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct sockaddr *sa, socklen_t salen)
{
switch_assert(buf);
*buf = '\0';
+
if (sa) {
getnameinfo(sa, salen, buf, (socklen_t)len, NULL, 0, NI_NUMERICHOST);
}
@@ -1768,7 +1869,7 @@
char *o;
unsigned int tmp;
- if (switch_strlen_zero(s)) {
+ if (zstr(s)) {
return s;
}
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_xml.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_xml.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_xml.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1551,7 +1551,7 @@
const char *err = NULL;
err = switch_xml_error(xml);
- if (switch_strlen_zero(err)) {
+ if (zstr(err)) {
if ((conf = switch_xml_find_child(xml, "section", "name", "result"))) {
switch_xml_t p;
const char *aname;
@@ -1890,7 +1890,7 @@
*err = switch_xml_error(new_main);
switch_copy_string(not_so_threadsafe_error_buffer, *err, sizeof(not_so_threadsafe_error_buffer));
*err = not_so_threadsafe_error_buffer;
- if (!switch_strlen_zero(*err)) {
+ if (!zstr(*err)) {
switch_xml_free(new_main);
new_main = NULL;
errcnt++;
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_xml_config.c (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_xml_config.c 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/src/switch_xml_config.c 2009-11-02 10:10:22 UTC (rev 15314)
@@ -208,7 +208,7 @@
/* Perform validation */
if (value) {
- if (!switch_strlen_zero(string_options->validation_regex)) {
+ 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 {
Modified: freeswitch/branches/joshrivers/mod_managed_experimental_refactor/support-d/fscore_pb (15313 => 15314)
--- freeswitch/branches/joshrivers/mod_managed_experimental_refactor/support-d/fscore_pb 2009-11-02 08:01:08 UTC (rev 15313)
+++ freeswitch/branches/joshrivers/mod_managed_experimental_refactor/support-d/fscore_pb 2009-11-02 10:10:22 UTC (rev 15314)
@@ -1,11 +1,35 @@
-core=`ls -rt core.* 2> /dev/null`
+#!/bin/bash
+arg=$1
+shift
+
+prefix=$(cat config.status | grep @prefix@ | awk -F, '{print $3}')
+
+if [ -z "$prefix" ] ; then
+ echo "Cannot determine prefix!"
+ exit 255
+fi
+
+if [ "$arg" = "gcore" ] ; then
+ user=$1
+ shift
+ fspid=`cat $prefix/log/freeswitch.pid`
+ echo "pulling gcore $fspid"
+ gcore -o core $fspid
+exit
+else
+ user=$arg
+fi
+
+
+core=`ls -1t core.* | head -1 2> /dev/null`
+
if [ -z "$core" ] ; then
- core=`ls -rt core 2> /dev/null`
+ core=`ls -1 core 2> /dev/null`
fi
if [ -z "$core" ] ; then
- core=`ls -rt freeswitch.core 2> /dev/null`
+ core=`ls -1 freeswitch.core 2> /dev/null`
fi
if [ -z "$core" ] ; then
@@ -18,15 +42,15 @@
exit 255
fi
+echo "core is $core"
line="--------------------------------------------------------------------------------"
mypwd=`pwd`
tmpdir=/tmp/fscore_pb.tmp
-post_file=$pwd/fscore_pb.post
-user=$1
-shift
+post_file=$mypwd/fscore_pb.post
+
if [ -z $user ] ; then
user=$SUDO_USER
fi
@@ -61,7 +85,7 @@
echo "GDB BACKTRACE:" >> $post_file
echo $line >> $post_file
-gdb /usr/local/freeswitch/bin/freeswitch `echo $core | tail -n1` \
+gdb $prefix/bin/freeswitch `echo $core | tail -n1` \
--eval-command="echo \n\n" \
--eval-command="set pagination off" \
--eval-command="echo Stack Trace\n" \