FS-11880: [Core,mod_pgsql] Remove native PostgreSQL support from the core, add mod_pgsql database module.

v1.10
Andrey Volk 4 years ago
parent 3588cd5c51
commit ccc4ae282a
  1. 17
      Freeswitch.2017.sln
  2. 2
      Makefile.am
  3. 1
      build/modules.conf.in
  4. 1
      build/modules.conf.most
  5. 6
      conf/rayo/autoload_configs/pre_load_modules.conf.xml
  6. 20
      conf/rayo/autoload_configs/switch.conf.xml
  7. 6
      conf/testing/autoload_configs/pre_load_modules.conf.xml
  8. 20
      conf/testing/autoload_configs/switch.conf.xml
  9. 6
      conf/vanilla/autoload_configs/pre_load_modules.conf.xml
  10. 20
      conf/vanilla/autoload_configs/switch.conf.xml
  11. 117
      configure.ac
  12. 5
      debian/bootstrap.sh
  13. 7
      debian/control-modules
  14. 3
      debian/rules
  15. 37
      freeswitch.spec
  16. 1
      src/include/switch.h
  17. 20
      src/include/switch_core.h
  18. 2
      src/include/switch_module_interfaces.h
  19. 173
      src/include/switch_pgsql.h
  20. 2
      src/include/switch_types.h
  21. 2
      src/mod/applications/mod_directory/mod_directory.c
  22. 2
      src/mod/applications/mod_fifo/mod_fifo.c
  23. 18
      src/mod/databases/mod_pgsql/Makefile.am
  24. 150
      src/mod/databases/mod_pgsql/mod_pgsql.2017.vcxproj
  25. 1155
      src/mod/databases/mod_pgsql/mod_pgsql.c
  26. 4
      src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am
  27. 630
      src/mod/languages/mod_managed/freeswitch_wrap.cxx
  28. 2
      src/mod/languages/mod_managed/managed/examples/winFailToBan/winFailToBan.csproj
  29. 681
      src/mod/languages/mod_managed/managed/swig.cs
  30. 205
      src/switch_core_sqldb.c
  31. 3
      w32/Library/FreeSwitchCore.2017.vcxproj
  32. 8
      w32/Setup/Setup.2017.wixproj

@ -580,6 +580,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ffmpeg", "libs\win32\ffmpeg
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Setup.CA.DownloadOpenH264", "w32\Setup\CustomActions\Setup.CA.DownloadOpenH264\Setup.CA.DownloadOpenH264.csproj", "{EBFDCFCA-8095-4ECC-98BE-B494BCB4E042}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Databases", "Databases", "{31C2761D-20E0-4BF8-98B9-E32F0D8DD6E1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_pgsql", "src\mod\databases\mod_pgsql\mod_pgsql.2017.vcxproj", "{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Win32 = All|Win32
@ -2659,6 +2663,18 @@ Global
{EBFDCFCA-8095-4ECC-98BE-B494BCB4E042}.Release|Win32.Build.0 = Release|x86
{EBFDCFCA-8095-4ECC-98BE-B494BCB4E042}.Release|x64.ActiveCfg = Release|x86
{EBFDCFCA-8095-4ECC-98BE-B494BCB4E042}.Release|x64.Build.0 = Release|x86
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.All|Win32.ActiveCfg = Release|Win32
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.All|Win32.Build.0 = Release|Win32
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.All|x64.ActiveCfg = Release|x64
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.All|x64.Build.0 = Release|x64
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Debug|Win32.ActiveCfg = Debug|Win32
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Debug|Win32.Build.0 = Debug|Win32
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Debug|x64.ActiveCfg = Debug|x64
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Debug|x64.Build.0 = Debug|x64
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Release|Win32.ActiveCfg = Release|Win32
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Release|Win32.Build.0 = Release|Win32
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Release|x64.ActiveCfg = Release|x64
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -2869,6 +2885,7 @@ Global
{EBD0B6B4-C5CA-46B0-BBC7-DBA71DF05D31} = {4F227C26-768F-46A3-8684-1D08A46FB374}
{B19AE6FC-BFFF-428D-B483-3BBEAECCC618} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{BC1FD72E-1CD5-4525-A7F5-17C5740BFDED} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{1BA65811-5453-46F6-8190-9ECEEFEB7DF2} = {31C2761D-20E0-4BF8-98B9-E32F0D8DD6E1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {09840DE7-9208-45AA-9667-1A71EE93BD1E}

@ -326,7 +326,6 @@ library_include_HEADERS = \
libs/libteletone/src/libteletone.h \
src/include/switch_limit.h \
src/include/switch_odbc.h \
src/include/switch_pgsql.h \
src/include/switch_hashtable.h \
src/include/switch_image.h
@ -390,7 +389,6 @@ libfreeswitch_la_SOURCES = \
src/switch_config.c \
src/switch_time.c \
src/switch_odbc.c \
src/switch_pgsql.c \
src/switch_limit.c \
src/g711.c \
src/switch_pcm.c \

@ -79,6 +79,7 @@ codecs/mod_opus
#codecs/mod_silk
#codecs/mod_siren
#codecs/mod_theora
databases/mod_pgsql
dialplans/mod_dialplan_asterisk
#dialplans/mod_dialplan_directory
dialplans/mod_dialplan_xml

@ -76,6 +76,7 @@ codecs/mod_sangoma_codec
codecs/mod_silk
codecs/mod_siren
codecs/mod_theora
databases/mod_pgsql
dialplans/mod_dialplan_asterisk
dialplans/mod_dialplan_directory
dialplans/mod_dialplan_xml

@ -0,0 +1,6 @@
<configuration name="pre_load_modules.conf" description="Modules">
<modules>
<!-- Databases -->
<load module="mod_pgsql"/>
</modules>
</configuration>

@ -147,7 +147,27 @@
<param name="rtp-enable-zrtp" value="true"/>
<!--
Native PostgreSQL support was removed from the FreeSWITCH Core!
=================================
NOTICE: You MUST enable mod_pgsql
=================================
According to https://www.postgresql.org/docs/9.6/libpq-connect.html#LIBPQ-CONNSTRING
There are two accepted formats for connection strings supported by the libpq library:
* For plain keyword = value strings use pgsql://
pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE' application_name='freeswitch'
* For RFC 3986 URIs use postgresql:// or postgres://
postgresql://
postgresql://localhost
postgresql://localhost:5433
postgresql://localhost/mydb
postgresql://user@localhost
postgresql://user:secret@localhost
postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
postgresql:///mydb?host=localhost&port=5433
-->
<!-- <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE' application_name='freeswitch'" /> -->
<!-- <param name="core-db-dsn" value="postgresql://freeswitch:@127.0.0.1/freeswitch?options=-c%20client_min_messages%3DNOTICE&application_name=freeswitch" /> -->
<!-- <param name="core-db-dsn" value="dsn:username:password" /> -->
<!--
Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for

@ -0,0 +1,6 @@
<configuration name="pre_load_modules.conf" description="Modules">
<modules>
<!-- Databases -->
<load module="mod_pgsql"/>
</modules>
</configuration>

@ -152,7 +152,27 @@
<param name="rtp-enable-zrtp" value="true"/>
<!--
Native PostgreSQL support was removed from the FreeSWITCH Core!
=================================
NOTICE: You MUST enable mod_pgsql
=================================
According to https://www.postgresql.org/docs/9.6/libpq-connect.html#LIBPQ-CONNSTRING
There are two accepted formats for connection strings supported by the libpq library:
* For plain keyword = value strings use pgsql://
pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE'
* For RFC 3986 URIs use postgresql:// or postgres://
postgresql://
postgresql://localhost
postgresql://localhost:5433
postgresql://localhost/mydb
postgresql://user@localhost
postgresql://user:secret@localhost
postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
postgresql:///mydb?host=localhost&port=5433
-->
<!-- <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE'" /> -->
<!-- <param name="core-db-dsn" value="postgresql://freeswitch:@127.0.0.1/freeswitch?options=-c%20client_min_messages%3DNOTICE" /> -->
<!-- <param name="core-db-dsn" value="dsn:username:password" /> -->
<!--
Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for

@ -0,0 +1,6 @@
<configuration name="pre_load_modules.conf" description="Modules">
<modules>
<!-- Databases -->
<load module="mod_pgsql"/>
</modules>
</configuration>

@ -161,7 +161,27 @@
-->
<!-- <param name="rtp-retain-crypto-keys" value="true"/> -->
<!--
Native PostgreSQL support was removed from the FreeSWITCH Core!
=================================
NOTICE: You MUST enable mod_pgsql
=================================
According to https://www.postgresql.org/docs/9.6/libpq-connect.html#LIBPQ-CONNSTRING
There are two accepted formats for connection strings supported by the libpq library:
* For plain keyword = value strings use pgsql://
pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE'
* For RFC 3986 URIs use postgresql:// or postgres://
postgresql://
postgresql://localhost
postgresql://localhost:5433
postgresql://localhost/mydb
postgresql://user@localhost
postgresql://user:secret@localhost
postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
postgresql:///mydb?host=localhost&port=5433
-->
<!-- <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE'" /> -->
<!-- <param name="core-db-dsn" value="postgresql://freeswitch:@127.0.0.1/freeswitch?options=-c%20client_min_messages%3DNOTICE" /> -->
<!-- <param name="core-db-dsn" value="dsn:username:password" /> -->
<!--
Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for

@ -643,60 +643,67 @@ CHECK_LIBUUID
SWITCH_AM_LDFLAGS="$LIBUUID_LIBS $SWITCH_AM_LDFLAGS"
SWITCH_AM_CFLAGS="$LIBUUID_CFLAGS $SWITCH_AM_CFLAGS"
AC_ARG_ENABLE(core-pgsql-support,
[AS_HELP_STRING([--enable-core-pgsql-support], [Compile with PGSQL Support])],,[enable_core_pgsql_support="no"])
AC_ARG_ENABLE(core-pgsql-pkgconfig,
[AS_HELP_STRING([--disable-core-pgsql-pkgconfig], [Use pg_config to get PGQSL build options])],[enable_core_pgsql_pkgconfig="$enableval"],[enable_core_pgsql_pkgconfig="yes"])
if test x"$enable_core_pgsql_support" = x"yes" ; then
AC_PATH_PROG([PG_CONFIG], [pg_config], [no])
AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
if test "$PKG_CONFIG" = "no" \
|| test x"$enable_core_pgsql_pkgconfig" = x"no" \
|| ! pkg-config libpq; then
path_remove () {
echo "$1" | tr ':' '\n' | grep -Fxv "$2" | tr '\n' ':' | sed 's/:$//'
}
path_push_unique () {
x="$(eval echo \$$1)"
x="$(path_remove "$x" "$2")"
if test -z "$x"; then
eval export $1="$2"
else
eval export $1="$2:$x"
fi
}
AC_PATH_PROG([PG_CONFIG], [pg_config], [no])
AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
case $host in
*-darwin*)
path_push_unique PKG_CONFIG_PATH /usr/local/opt/libpq/lib/pkgconfig
;;
esac
if test "$PKG_CONFIG" = "no" \
|| test x"$enable_core_pgsql_pkgconfig" = x"no" \
|| ! pkg-config libpq; then
if test "$PG_CONFIG" != "no"; then
AC_MSG_CHECKING([for PostgreSQL libraries via pg_config])
POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`"
POSTGRESQL_LIBDIR="-L`$PG_CONFIG --libdir`"
POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir` -lpq"
POSTGRESQL_VERSION=`$PG_CONFIG --version | awk '{ print $NF }'`
POSTGRESQL_MAJOR_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $1 }'`
POSTGRESQL_MINOR_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $2 }'`
POSTGRESQL_PATCH_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $3 }'`
else
AC_MSG_ERROR([no usable pkg-config or pg_config; please install libpq devel package or equivalent])
fi
else
AC_MSG_CHECKING([for PostgreSQL libraries via pkg_config])
POSTGRESQL_CFLAGS="`$PKG_CONFIG --cflags libpq`"
POSTGRESQL_LIBDIR="`$PKG_CONFIG libpq --libs-only-L`"
POSTGRESQL_LDFLAGS="`$PKG_CONFIG --libs libpq`"
POSTGRESQL_VERSION="`$PKG_CONFIG --modversion libpq`"
POSTGRESQL_MAJOR_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f1 | sed 's/^\([[0-9]]*\)[[^0-9]].*/\1/'`"
POSTGRESQL_MINOR_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f2 | sed 's/^\([[0-9]]*\)[[^0-9]].*/\1/'`"
POSTGRESQL_PATCH_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f3 | sed 's/^\([[0-9]]*\)[[^0-9]].*/\1/'`"
test -n "$POSTGRESQL_PATCH_VERSION" || POSTGRESQL_PATCH_VERSION=0
fi
save_LIBS="$LIBS"
LIBS="$POSTGRESQL_LIBDIR $LIBS"
AC_MSG_RESULT([$POSTGRESQL_LIBDIR])
AC_DEFINE([SWITCH_HAVE_PGSQL], [1], [Define to 1 if PostgreSQL libraries are available])
AM_CONDITIONAL([HAVE_PGSQL],[true])
AC_DEFINE_UNQUOTED([POSTGRESQL_VERSION], "${POSTGRESQL_VERSION}", [Specifies the version of PostgreSQL we are linking against])
AC_DEFINE_UNQUOTED([POSTGRESQL_MAJOR_VERSION], ${POSTGRESQL_MAJOR_VERSION}, [Specifies the version of PostgreSQL we are linking against])
AC_DEFINE_UNQUOTED([POSTGRESQL_MINOR_VERSION], ${POSTGRESQL_MINOR_VERSION}, [Specifies the version of PostgreSQL we are linking against])
AC_DEFINE_UNQUOTED([POSTGRESQL_PATCH_VERSION], ${POSTGRESQL_PATCH_VERSION}, [Specifies the version of PostgreSQL we are linking against])
AC_CHECK_LIB([pq], [PQgetvalue],, AC_MSG_ERROR([no usable libpq; please install PostgreSQL devel package or equivalent]))
AC_MSG_RESULT([yes])
SWITCH_AM_CXXFLAGS="$POSTGRESQL_CFLAGS $SWITCH_AM_CXXFLAGS"
SWITCH_AM_LDFLAGS="$POSTGRESQL_LDFLAGS $SWITCH_AM_LDFLAGS"
LIBS="$save_LIBS"
AC_MSG_CHECKING([for PostgreSQL libraries via pg_config])
POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`"
POSTGRESQL_LIBDIR="-L`$PG_CONFIG --libdir`"
POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir` -lpq"
POSTGRESQL_VERSION=`$PG_CONFIG --version | awk '{ print $NF }'`
POSTGRESQL_MAJOR_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $1 }'`
POSTGRESQL_MINOR_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $2 }'`
POSTGRESQL_PATCH_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $3 }'`
fi
else
AM_CONDITIONAL([HAVE_PGSQL],[false])
AC_MSG_CHECKING([for PostgreSQL libraries via pkg_config])
POSTGRESQL_CFLAGS="`$PKG_CONFIG --cflags libpq`"
POSTGRESQL_LIBDIR="`$PKG_CONFIG libpq --libs-only-L`"
POSTGRESQL_LDFLAGS="`$PKG_CONFIG --libs libpq`"
POSTGRESQL_VERSION="`$PKG_CONFIG --modversion libpq`"
POSTGRESQL_MAJOR_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f1 | sed 's/^\([[0-9]]*\)[[^0-9]].*/\1/'`"
POSTGRESQL_MINOR_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f2 | sed 's/^\([[0-9]]*\)[[^0-9]].*/\1/'`"
POSTGRESQL_PATCH_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f3 | sed 's/^\([[0-9]]*\)[[^0-9]].*/\1/'`"
test -n "$POSTGRESQL_PATCH_VERSION" || POSTGRESQL_PATCH_VERSION=0
fi
AC_MSG_RESULT([$POSTGRESQL_LIBDIR])
AC_DEFINE_UNQUOTED([POSTGRESQL_VERSION], "${POSTGRESQL_VERSION}", [Specifies the version of PostgreSQL we are linking against])
AC_DEFINE_UNQUOTED([POSTGRESQL_MAJOR_VERSION], ${POSTGRESQL_MAJOR_VERSION}, [Specifies the version of PostgreSQL we are linking against])
AC_DEFINE_UNQUOTED([POSTGRESQL_MINOR_VERSION], ${POSTGRESQL_MINOR_VERSION}, [Specifies the version of PostgreSQL we are linking against])
AC_DEFINE_UNQUOTED([POSTGRESQL_PATCH_VERSION], ${POSTGRESQL_PATCH_VERSION}, [Specifies the version of PostgreSQL we are linking against])
have_libpq=no
AC_CHECK_LIB([pq], [PQgetvalue], [have_libpq="yes"])
AM_CONDITIONAL([HAVE_PGSQL],[test "${have_libpq}" = "yes"])
AC_SUBST([POSTGRESQL_CFLAGS], [$POSTGRESQL_CFLAGS])
AC_SUBST([POSTGRESQL_LDFLAGS], [$POSTGRESQL_LDFLAGS])
AC_SUBST([POSTGRESQL_LIBDIR], [$POSTGRESQL_LIBDIR])
AC_ARG_ENABLE(deprecated-core-db-events,
[AS_HELP_STRING([--enable-deprecated-core-db-events], [Keep deprecated core db events])],,[enable_deprecated_core_db_events="no"])
@ -709,19 +716,6 @@ ESL_LDFLAGS=
PLATFORM_CORE_LDFLAGS=
PLATFORM_CORE_LIBS=
path_remove () {
echo "$1" | tr ':' '\n' | grep -Fxv "$2" | tr '\n' ':' | sed 's/:$//'
}
path_push_unique () {
x="$(eval echo \$$1)"
x="$(path_remove "$x" "$2")"
if test -z "$x"; then
eval export $1="$2"
else
eval export $1="$2:$x"
fi
}
# tweak platform specific flags
case "$host" in
*darwin*)
@ -1930,6 +1924,7 @@ AC_CONFIG_FILES([Makefile
src/mod/codecs/mod_siren/Makefile
src/mod/codecs/mod_skel_codec/Makefile
src/mod/codecs/mod_theora/Makefile
src/mod/databases/mod_pgsql/Makefile
src/mod/dialplans/mod_dialplan_asterisk/Makefile
src/mod/dialplans/mod_dialplan_directory/Makefile
src/mod/dialplans/mod_dialplan_xml/Makefile

@ -418,6 +418,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-dptools (= \${binary:Version}),
freeswitch-mod-fifo (= \${binary:Version}),
freeswitch-mod-hash (= \${binary:Version}),
freeswitch-mod-pgsql (= \${binary:Version}),
freeswitch-mod-spandsp (= \${binary:Version}),
freeswitch-mod-voicemail (= \${binary:Version}),
freeswitch-mod-dialplan-xml (= \${binary:Version}),
@ -468,6 +469,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-expr (= \${binary:Version}),
freeswitch-mod-fifo (= \${binary:Version}),
freeswitch-mod-hash (= \${binary:Version}),
freeswitch-mod-pgsql (= \${binary:Version}),
freeswitch-mod-voicemail (= \${binary:Version}),
freeswitch-mod-esf (= \${binary:Version}),
freeswitch-mod-fsv (= \${binary:Version}),
@ -534,6 +536,7 @@ Recommends:
freeswitch-mod-lcr (= \${binary:Version}),
freeswitch-mod-nibblebill (= \${binary:Version}),
freeswitch-mod-oreka (= \${binary:Version}),
freeswitch-mod-pgsql (= \${binary:Version}),
freeswitch-mod-redis (= \${binary:Version}),
freeswitch-mod-rss (= \${binary:Version}),
freeswitch-mod-sms (= \${binary:Version}),
@ -620,6 +623,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-memcache (= \${binary:Version}),
freeswitch-mod-nibblebill (= \${binary:Version}),
freeswitch-mod-oreka (= \${binary:Version}),
freeswitch-mod-pgsql (= \${binary:Version}),
freeswitch-mod-png (= \${binary:Version}),
freeswitch-mod-redis (= \${binary:Version}),
freeswitch-mod-rss (= \${binary:Version}),
@ -859,6 +863,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-memcache-dbg (= \${binary:Version}),
freeswitch-mod-nibblebill-dbg (= \${binary:Version}),
freeswitch-mod-oreka-dbg (= \${binary:Version}),
freeswitch-mod-pgsql-dbg (= \${binary:Version}),
freeswitch-mod-png-dbg (= \${binary:Version}),
freeswitch-mod-redis-dbg (= \${binary:Version}),
freeswitch-mod-rss-dbg (= \${binary:Version}),

@ -391,6 +391,13 @@ Module: codecs/mod_yuv
Description: Adds mod_yuv
Adds mod_yuv.
## mod/databases
Module: databases/mod_pgsql
Description: Adds mod_pgsql
Adds mod_pgsql.
Build-Depends: libpq-dev
## mod/dialplans
Module: dialplans/mod_dialplan_asterisk

3
debian/rules vendored

@ -74,8 +74,7 @@ override_dh_auto_clean:
--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr --localstatedir=/var --sysconfdir=/etc \
--with-gnu-ld --with-python --with-erlang --with-openssl \
--enable-core-odbc-support --enable-zrtp \
--enable-core-pgsql-support
--enable-core-odbc-support --enable-zrtp
touch $@
override_dh_auto_configure: .stamp-configure

@ -3,7 +3,7 @@
# spec file for package freeswitch
#
# includes module(s): freeswitch-devel freeswitch-codec-passthru-amr freeswitch-codec-passthru-amrwb freeswitch-codec-passthru-g729
# freeswitch-codec-passthru-g7231 freeswitch-lua freeswitch-perl freeswitch-python freeswitch-v8 freeswitch-signalwire
# freeswitch-codec-passthru-g7231 freeswitch-lua freeswitch-pgsql freeswitch-perl freeswitch-python freeswitch-v8 freeswitch-signalwire
# freeswitch-lan-de freeswitch-lang-en freeswitch-lang-fr freeswitch-lang-hu freeswitch-lang-ru freeswitch-freetdm
# and others
#
@ -838,6 +838,20 @@ Requires: %{name} = %{version}-%{release}
%description codec-theora
Theora Video Codec support for FreeSWITCH open source telephony platform.
######################################################################################################################
# FreeSWITCH Database Modules
######################################################################################################################
%package database-pgsql
Summary: PostgreSQL native support for FreeSWITCH
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
Requires: postgresql-libs
BuildRequires: postgresql-devel
%description database-pgsql
PostgreSQL native support for FreeSWITCH.
######################################################################################################################
# FreeSWITCH Directory Modules
######################################################################################################################
@ -1419,6 +1433,7 @@ Requires: freeswitch-codec-passthru-g729
Requires: freeswitch-codec-h26x
Requires: freeswitch-codec-ilbc
Requires: freeswitch-codec-siren
Requires: freeswitch-database-pgsql
Requires: freeswitch-format-local-stream
Requires: freeswitch-format-native-file
Requires: freeswitch-format-portaudio-stream
@ -1514,6 +1529,13 @@ CODECS_MODULES="codecs/mod_amr codecs/mod_amrwb codecs/mod_bv codecs/mod_codec2
CODECS_MODULES+="codecs/mod_sangoma_codec"
%endif
######################################################################################################################
#
# Database Modules
#
######################################################################################################################
DATABASES_MODULES="databases/mod_pgsql"
######################################################################################################################
#
# Dialplan Modules
@ -1616,7 +1638,7 @@ XML_INT_MODULES="xml_int/mod_xml_cdr xml_int/mod_xml_curl xml_int/mod_xml_rpc"
# Create one environment variable out of all the module defs
#
######################################################################################################################
MYMODULES="$APPLICATIONS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES \
MYMODULES="$APPLICATIONS_MODULES $CODECS_MODULES $DATABASES_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES \
$ENDPOINTS_MODULES $ASR_TTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES \
$SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES"
@ -1669,7 +1691,6 @@ autoreconf --force --install
--with-dbdir=%{DBDIR} \
--with-htdocsdir=%{HTDOCSDIR} \
--with-soundsdir=%{SOUNDSDIR} \
--enable-core-pgsql-support \
--enable-core-odbc-support \
--enable-core-libedit-support \
--with-grammardir=%{GRAMMARDIR} \
@ -1987,6 +2008,7 @@ fi
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/pocketsphinx.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/portaudio.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/post_load_modules.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/pre_load_modules.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/presence_map.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/redis.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/rss.conf.xml
@ -2262,6 +2284,15 @@ fi
%files codec-theora
%{MODINSTDIR}/mod_theora.so*
######################################################################################################################
#
# FreeSWITCH Database Modules
#
######################################################################################################################
%files database-pgsql
%{MODINSTDIR}/mod_pgsql.so*
######################################################################################################################
#
# FreeSWITCH Directory Modules

@ -138,7 +138,6 @@
#include "switch_config.h"
#include "switch_nat.h"
#include "switch_odbc.h"
#include "switch_pgsql.h"
#include "switch_json.h"
#include "switch_limit.h"
#include "switch_core_media.h"

@ -2479,14 +2479,12 @@ typedef enum {
typedef enum {
SCDB_TYPE_CORE_DB,
SCDB_TYPE_ODBC,
SCDB_TYPE_PGSQL,
SCDB_TYPE_DATABASE_INTERFACE
} switch_cache_db_handle_type_t;
typedef union {
switch_core_db_t *core_db_dbh;
switch_odbc_handle_t *odbc_dbh;
switch_pgsql_handle_t *pgsql_dbh;
switch_database_interface_handle_t *database_interface_dbh;
} switch_cache_db_native_handle_t;
@ -2501,11 +2499,8 @@ typedef struct {
} switch_cache_db_odbc_options_t;
typedef struct {
char *dsn;
} switch_cache_db_pgsql_options_t;
typedef struct {
char *dsn;
const char *original_dsn;
char *connection_string;
char prefix[16];
switch_database_interface_t *database_interface;
switch_bool_t make_module_no_unloadable;
@ -2514,7 +2509,6 @@ typedef struct {
typedef union {
switch_cache_db_core_db_options_t core_db_options;
switch_cache_db_odbc_options_t odbc_options;
switch_cache_db_pgsql_options_t pgsql_options;
switch_cache_db_database_interface_options_t database_interface_options;
} switch_cache_db_connection_options_t;
@ -2531,11 +2525,6 @@ static inline const char *switch_cache_db_type_name(switch_cache_db_handle_type_
type_str = "DATABASE_INTERFACE";
}
break;
case SCDB_TYPE_PGSQL:
{
type_str = "PGSQL";
}
break;
case SCDB_TYPE_ODBC:
{
type_str = "ODBC";
@ -2674,6 +2663,11 @@ SWITCH_DECLARE(void) switch_cache_db_database_interface_flush_handles(switch_dat
*/
SWITCH_DECLARE(switch_status_t) switch_core_check_core_db_dsn(void);
/*!
\brief Returns error if no suitable database interface found for a dsn.
*/
SWITCH_DECLARE(switch_status_t) switch_database_available(char* dsn);
SWITCH_DECLARE(void) switch_core_set_signal_handlers(void);
SWITCH_DECLARE(uint32_t) switch_core_debug_level(void);
SWITCH_DECLARE(int32_t) switch_core_sps(void);

@ -621,7 +621,7 @@ struct switch_database_interface {
const char *interface_name;
/*! flags indicating database specifics, see switch_database_flag_t */
uint32_t flags;
switch_status_t(*handle_new)(char *dsn, switch_database_interface_handle_t **dih);
switch_status_t(*handle_new)(switch_cache_db_database_interface_options_t database_interface_options, switch_database_interface_handle_t **dih);
switch_status_t(*handle_destroy)(switch_database_interface_handle_t **dih);
switch_status_t(*flush)(switch_database_interface_handle_t *dih);
switch_status_t(*exec_detailed)(const char *file, const char *func, int line,

@ -1,173 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, 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>
* Eliot Gable <egable@gmail.com>
*
* switch_pgsql.h -- PGSQL Driver
*
*/
#ifndef SWITCH_PGSQL_H
#define SWITCH_PGSQL_H
#include <switch.h>
#define DEFAULT_PGSQL_RETRIES 120
SWITCH_BEGIN_EXTERN_C
struct switch_pgsql_handle;
struct switch_pgsql_result;
typedef enum {
SWITCH_PGSQL_STATE_INIT,
SWITCH_PGSQL_STATE_DOWN,
SWITCH_PGSQL_STATE_CONNECTED,
SWITCH_PGSQL_STATE_ERROR
} switch_pgsql_state_t;
typedef enum {
SWITCH_PGSQL_SUCCESS = 0,
SWITCH_PGSQL_FAIL = -1
} switch_pgsql_status_t;
/*!
\brief Create a new handle for the PGSQL connection.
\param dsn The DSN of the database to connect to. See documentation for PQconnectdb() at
http://www.postgresql.org/docs/9.0/static/libpq-connect.html. The DSN *MUST* be
prefixed with 'pgsql;' to use the switch_cache_db* functionality. However, the DSN
passed to this function directly *MUST NOT* be prefixed with 'pgsql;'.
\return Returns a pointer to a newly allocated switch_pgsql_handle_t type or NULL on failure.
*/
SWITCH_DECLARE(switch_pgsql_handle_t *) switch_pgsql_handle_new(const char *dsn);
/*!
\brief Sets the number of retries if the PGSQL connection fails.
\param handle A fully allocated switch_pgsql_handle_t returned from a call to switch_pgsql_handle_new().
\param num_retries How many times to retry connecting to the database if this connection fails.
*/
SWITCH_DECLARE(void) switch_pgsql_set_num_retries(switch_pgsql_handle_t *handle, int num_retries);
/*!
\brief Disconnects a PGSQL connection from the database.
\param handle The PGSQL database handle to disconnect.
\return Returns SWITCH_PGSQL_SUCCESS or SWITCH_PGSQL_FAIL.
*/
SWITCH_DECLARE(switch_pgsql_status_t ) switch_pgsql_handle_disconnect(switch_pgsql_handle_t *handle);
#if 0
) /* Emacs formatting issue */
#endif
/*!
\brief Connect to the database specified by the DSN passed to the switch_pgsql_handle_new() call which
initialized this handle.
\param The database handle to connect to the database.
\return Returns SWITCH_PGSQL_SUCCESS or SWITCH_PGSQL_FAIL.
*/
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_connect(switch_pgsql_handle_t *handle);
/*!
*/
SWITCH_DECLARE(void) switch_pgsql_handle_destroy(switch_pgsql_handle_t **handlep);
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_send_query(switch_pgsql_handle_t *handle, const char* sql);
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_cancel_real(const char *file, const char *func, int line, switch_pgsql_handle_t *handle);
#define switch_pgsql_cancel(handle) switch_pgsql_cancel_real(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, handle)
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_next_result_timed(switch_pgsql_handle_t *handle, switch_pgsql_result_t **result_out, int seconds);
#define switch_pgsql_next_result(h, r) switch_pgsql_next_result_timed(h, r, 10000)
SWITCH_DECLARE(void) switch_pgsql_free_result(switch_pgsql_result_t **result);
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_finish_results_real(const char* file, const char *func, int line, switch_pgsql_handle_t *handle);
#define switch_pgsql_finish_results(handle) switch_pgsql_finish_results_real(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, handle)
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_exec_base_detailed(const char *file, const char *func, int line,
switch_pgsql_handle_t *handle, const char *sql, char **err);
#define switch_pgsql_handle_exec_base(handle, sql, err) switch_pgsql_handle_exec_base_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, handle, sql, err)
SWITCH_DECLARE(switch_pgsql_state_t) switch_pgsql_handle_get_state(switch_pgsql_handle_t *handle);
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_exec_detailed(const char *file, const char *func, int line,
switch_pgsql_handle_t *handle, const char *sql, char **err);
#define switch_pgsql_handle_exec(handle, sql, err) switch_pgsql_handle_exec_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, handle, sql, err)
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_exec_string_detailed(const char *file, const char *func, int line,
switch_pgsql_handle_t *handle, const char *sql, char *resbuf, size_t len, char **err);
#define switch_pgsql_handle_exec_string(handle, sql, resbuf, len, err) switch_pgsql_handle_exec_string_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, handle, sql, resbuf, len, err)
SWITCH_DECLARE(switch_bool_t) switch_pgsql_available(void);
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_SQLSetAutoCommitAttr(switch_pgsql_handle_t *handle, switch_bool_t on);
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_SQLEndTran(switch_pgsql_handle_t *handle, switch_bool_t commit);
/*!
\brief Execute the sql query and issue a callback for each row returned
\param file the file from which this function is called
\param func the function from which this function is called
\param line the line from which this function is called
\param handle the PGSQL handle
\param sql the sql string to execute
\param callback the callback function to execute
\param pdata the state data passed on each callback invocation
\return SWITCH_STATUS_SUCCESS if the operation was successful
\note none
*/
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_callback_exec_detailed(const char *file, const char *func, int line, switch_pgsql_handle_t *handle,
const char *sql, switch_core_db_callback_func_t callback, void *pdata,
char **err);
/*!
\brief Execute the sql query and issue a callback for each row returned
\param handle the PGSQL handle
\param sql the sql string to execute
\param callback the callback function to execute
\param pdata the state data passed on each callback invocation
\return SWITCH_STATUS_SUCCESS if the operation was successful
\note none
*/
#define switch_pgsql_handle_callback_exec(handle, sql, callback, pdata, err) \
switch_pgsql_handle_callback_exec_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, \
handle, sql, callback, pdata, err)
SWITCH_DECLARE(char *) switch_pgsql_handle_get_error(switch_pgsql_handle_t *handle);
SWITCH_DECLARE(int) switch_pgsql_handle_affected_rows(switch_pgsql_handle_t *handle);
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_flush(switch_pgsql_handle_t *handle);
SWITCH_END_EXTERN_C
#endif
/* 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 noet:
*/

@ -2315,8 +2315,6 @@ typedef struct switch_buffer switch_buffer_t;
typedef union switch_codec_settings switch_codec_settings_t;
typedef struct switch_codec_fmtp switch_codec_fmtp_t;
typedef struct switch_odbc_handle switch_odbc_handle_t;
typedef struct switch_pgsql_handle switch_pgsql_handle_t;
typedef struct switch_pgsql_result switch_pgsql_result_t;
typedef struct switch_database_interface_handle switch_database_interface_handle_t;
typedef struct switch_io_routines switch_io_routines_t;

@ -468,7 +468,7 @@ static switch_status_t load_config(switch_bool_t reload)
char *val = (char *) switch_xml_attr_soft(param, "value");
if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
if (switch_odbc_available() || switch_pgsql_available()) {
if (switch_database_available(val)) {
switch_set_string(globals.odbc_dsn, val);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");

@ -4392,7 +4392,7 @@ static switch_status_t read_config_file(switch_xml_t *xml, switch_xml_t *cfg) {
if (!strcasecmp(var, "outbound-strategy") && !zstr(val)) {
globals.default_strategy = parse_strategy(val);
} else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
if (switch_odbc_available() || switch_pgsql_available()) {
if (switch_database_available(val)) {
switch_set_string(globals.odbc_dsn, val);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");

@ -0,0 +1,18 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_pgsql
if HAVE_PGSQL
mod_LTLIBRARIES = mod_pgsql.la
mod_pgsql_la_SOURCES = mod_pgsql.c
mod_pgsql_la_CFLAGS = $(AM_CFLAGS) $(POSTGRESQL_CFLAGS)
mod_pgsql_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_pgsql_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(POSTGRESQL_LDFLAGS)
else
install: error
all: error
error:
$(error You must install libpq-dev to build mod_pgsql)
endif

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>mod_pgsql</ProjectName>
<RootNamespace>mod_pgsql</RootNamespace>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{1BA65811-5453-46F6-8190-9ECEEFEB7DF2}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="..\..\..\..\w32\libpq.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mod_pgsql.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2017.vcxproj">
<Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -5,9 +5,9 @@ if HAVE_PGSQL
mod_LTLIBRARIES = mod_cdr_pg_csv.la
mod_cdr_pg_csv_la_SOURCES = mod_cdr_pg_csv.c
mod_cdr_pg_csv_la_CFLAGS = $(AM_CFLAGS) $(SWITCH_AM_CXXFLAGS)
mod_cdr_pg_csv_la_CFLAGS = $(AM_CFLAGS) $(SWITCH_AM_CXXFLAGS) $(POSTGRESQL_CFLAGS)
mod_cdr_pg_csv_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_cdr_pg_csv_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lpq $(SWITCH_AM_LDFLAGS)
mod_cdr_pg_csv_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lpq $(SWITCH_AM_LDFLAGS) $(POSTGRESQL_LDFLAGS)
else
install: error

@ -16978,28 +16978,6 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_native_ha
}
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_native_handle_t_pgsql_dbh_set___(void * jarg1, void * jarg2) {
switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
switch_pgsql_handle_t *arg2 = (switch_pgsql_handle_t *) 0 ;
arg1 = (switch_cache_db_native_handle_t *)jarg1;
arg2 = (switch_pgsql_handle_t *)jarg2;
if (arg1) (arg1)->pgsql_dbh = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_native_handle_t_pgsql_dbh_get___(void * jarg1) {
void * jresult ;
switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
switch_pgsql_handle_t *result = 0 ;
arg1 = (switch_cache_db_native_handle_t *)jarg1;
result = (switch_pgsql_handle_t *) ((arg1)->pgsql_dbh);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_native_handle_t_database_interface_dbh_set___(void * jarg1, void * jarg2) {
switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
switch_database_interface_handle_t *arg2 = (switch_database_interface_handle_t *) 0 ;
@ -17196,79 +17174,60 @@ SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_delete_switch_cache_db_odbc
}
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_pgsql_options_t_dsn_set___(void * jarg1, char * jarg2) {
switch_cache_db_pgsql_options_t *arg1 = (switch_cache_db_pgsql_options_t *) 0 ;
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_database_interface_options_t_original_dsn_set___(void * jarg1, char * jarg2) {
switch_cache_db_database_interface_options_t *arg1 = (switch_cache_db_database_interface_options_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_cache_db_pgsql_options_t *)jarg1;
arg1 = (switch_cache_db_database_interface_options_t *)jarg1;
arg2 = (char *)jarg2;
{
delete [] arg1->dsn;
if (arg2) {
arg1->dsn = (char *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->dsn, (const char *)arg2);
arg1->original_dsn = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->original_dsn, (const char *)arg2);
} else {
arg1->dsn = 0;
arg1->original_dsn = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_pgsql_options_t_dsn_get___(void * jarg1) {
SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_database_interface_options_t_original_dsn_get___(void * jarg1) {
char * jresult ;
switch_cache_db_pgsql_options_t *arg1 = (switch_cache_db_pgsql_options_t *) 0 ;
switch_cache_db_database_interface_options_t *arg1 = (switch_cache_db_database_interface_options_t *) 0 ;
char *result = 0 ;
arg1 = (switch_cache_db_pgsql_options_t *)jarg1;
result = (char *) ((arg1)->dsn);
arg1 = (switch_cache_db_database_interface_options_t *)jarg1;
result = (char *) ((arg1)->original_dsn);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_new_switch_cache_db_pgsql_options_t___() {
void * jresult ;
switch_cache_db_pgsql_options_t *result = 0 ;
result = (switch_cache_db_pgsql_options_t *)new switch_cache_db_pgsql_options_t();
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_delete_switch_cache_db_pgsql_options_t___(void * jarg1) {
switch_cache_db_pgsql_options_t *arg1 = (switch_cache_db_pgsql_options_t *) 0 ;
arg1 = (switch_cache_db_pgsql_options_t *)jarg1;
delete arg1;
}
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_database_interface_options_t_dsn_set___(void * jarg1, char * jarg2) {
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_database_interface_options_t_connection_string_set___(void * jarg1, char * jarg2) {
switch_cache_db_database_interface_options_t *arg1 = (switch_cache_db_database_interface_options_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_cache_db_database_interface_options_t *)jarg1;
arg2 = (char *)jarg2;
{
delete [] arg1->dsn;
delete [] arg1->connection_string;
if (arg2) {
arg1->dsn = (char *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->dsn, (const char *)arg2);
arg1->connection_string = (char *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->connection_string, (const char *)arg2);
} else {
arg1->dsn = 0;
arg1->connection_string = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_database_interface_options_t_dsn_get___(void * jarg1) {
SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_database_interface_options_t_connection_string_get___(void * jarg1) {
char * jresult ;
switch_cache_db_database_interface_options_t *arg1 = (switch_cache_db_database_interface_options_t *) 0 ;
char *result = 0 ;
arg1 = (switch_cache_db_database_interface_options_t *)jarg1;
result = (char *) ((arg1)->dsn);
result = (char *) ((arg1)->connection_string);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
@ -17409,28 +17368,6 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_connectio
}
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_connection_options_t_pgsql_options_set___(void * jarg1, void * jarg2) {
switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
switch_cache_db_pgsql_options_t *arg2 = (switch_cache_db_pgsql_options_t *) 0 ;
arg1 = (switch_cache_db_connection_options_t *)jarg1;
arg2 = (switch_cache_db_pgsql_options_t *)jarg2;
if (arg1) (arg1)->pgsql_options = *arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_connection_options_t_pgsql_options_get___(void * jarg1) {
void * jresult ;
switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
switch_cache_db_pgsql_options_t *result = 0 ;
arg1 = (switch_cache_db_connection_options_t *)jarg1;
result = (switch_cache_db_pgsql_options_t *)& ((arg1)->pgsql_options);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cache_db_connection_options_t_database_interface_options_set___(void * jarg1, void * jarg2) {
switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
switch_cache_db_database_interface_options_t *arg2 = (switch_cache_db_database_interface_options_t *) 0 ;
@ -17817,6 +17754,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_check_core_db_ds
}
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_database_available___(char * jarg1) {
int jresult ;
char *arg1 = (char *) 0 ;
switch_status_t result;
arg1 = (char *)jarg1;
result = (switch_status_t)switch_database_available(arg1);
jresult = (int)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_set_signal_handlers___() {
switch_core_set_signal_handlers();
}
@ -31979,10 +31928,10 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_database_in
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_database_interface_handle_new_set___(void * jarg1, void * jarg2) {
switch_database_interface *arg1 = (switch_database_interface *) 0 ;
switch_status_t (*arg2)(char *,switch_database_interface_handle_t **) = (switch_status_t (*)(char *,switch_database_interface_handle_t **)) 0 ;
switch_status_t (*arg2)(switch_cache_db_database_interface_options_t,switch_database_interface_handle_t **) = (switch_status_t (*)(switch_cache_db_database_interface_options_t,switch_database_interface_handle_t **)) 0 ;
arg1 = (switch_database_interface *)jarg1;
arg2 = (switch_status_t (*)(char *,switch_database_interface_handle_t **))jarg2;
arg2 = (switch_status_t (*)(switch_cache_db_database_interface_options_t,switch_database_interface_handle_t **))jarg2;
if (arg1) (arg1)->handle_new = arg2;
}
@ -31990,10 +31939,10 @@ SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_database_interface_h
SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_database_interface_handle_new_get___(void * jarg1) {
void * jresult ;
switch_database_interface *arg1 = (switch_database_interface *) 0 ;
switch_status_t (*result)(char *,switch_database_interface_handle_t **) = 0 ;
switch_status_t (*result)(switch_cache_db_database_interface_options_t,switch_database_interface_handle_t **) = 0 ;
arg1 = (switch_database_interface *)jarg1;
result = (switch_status_t (*)(char *,switch_database_interface_handle_t **)) ((arg1)->handle_new);
result = (switch_status_t (*)(switch_cache_db_database_interface_options_t,switch_database_interface_handle_t **)) ((arg1)->handle_new);
jresult = (void *)result;
return jresult;
}
@ -39404,31 +39353,53 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_event_channel_broadca
}
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_event_channel_unbind___(char * jarg1, void * jarg2) {
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_event_channel_deliver___(char * jarg1, void * jarg2, char * jarg3, unsigned long jarg4) {
int jresult ;
char *arg1 = (char *) 0 ;
cJSON **arg2 = (cJSON **) 0 ;
char *arg3 = (char *) 0 ;
switch_event_channel_id_t arg4 ;
switch_status_t result;
arg1 = (char *)jarg1;
arg2 = (cJSON **)jarg2;
arg3 = (char *)jarg3;
arg4 = (switch_event_channel_id_t)jarg4;
result = (switch_status_t)switch_event_channel_deliver((char const *)arg1,arg2,(char const *)arg3,arg4);
jresult = (int)result;
return jresult;
}
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_event_channel_unbind___(char * jarg1, void * jarg2, void * jarg3) {
unsigned long jresult ;
char *arg1 = (char *) 0 ;
switch_event_channel_func_t arg2 = (switch_event_channel_func_t) 0 ;
void *arg3 = (void *) 0 ;
uint32_t result;
arg1 = (char *)jarg1;
arg2 = (switch_event_channel_func_t)jarg2;
result = (uint32_t)switch_event_channel_unbind((char const *)arg1,arg2);
arg3 = (void *)jarg3;
result = (uint32_t)switch_event_channel_unbind((char const *)arg1,arg2,arg3);
jresult = (unsigned long)result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_event_channel_bind___(char * jarg1, void * jarg2, void * jarg3) {
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_event_channel_bind___(char * jarg1, void * jarg2, void * jarg3, void * jarg4) {
int jresult ;
char *arg1 = (char *) 0 ;
switch_event_channel_func_t arg2 = (switch_event_channel_func_t) 0 ;
switch_event_channel_id_t *arg3 = (switch_event_channel_id_t *) 0 ;
void *arg4 = (void *) 0 ;
switch_status_t result;
arg1 = (char *)jarg1;
arg2 = (switch_event_channel_func_t)jarg2;
arg3 = (switch_event_channel_id_t *)jarg3;
result = (switch_status_t)switch_event_channel_bind((char const *)arg1,arg2,arg3);
arg4 = (void *)jarg4;
result = (switch_status_t)switch_event_channel_bind((char const *)arg1,arg2,arg3,arg4);
jresult = (int)result;
return jresult;
}
@ -43260,6 +43231,34 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_create___
}
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_create_json_obj___(void * jarg1, void * jarg2) {
int jresult ;
switch_dial_handle_t **arg1 = (switch_dial_handle_t **) 0 ;
cJSON *arg2 = (cJSON *) 0 ;
switch_status_t result;
arg1 = (switch_dial_handle_t **)jarg1;
arg2 = (cJSON *)jarg2;
result = (switch_status_t)switch_dial_handle_create_json_obj(arg1,arg2);
jresult = (int)result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_create_json___(void * jarg1, char * jarg2) {
int jresult ;