2023-10-09 00:34:58 +00:00
|
|
|
{
|
|
|
|
fetchFromGitHub,
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
pkg-config,
|
|
|
|
autoreconfHook,
|
|
|
|
ncurses,
|
|
|
|
gnutls,
|
|
|
|
readline,
|
|
|
|
openssl,
|
|
|
|
perl,
|
|
|
|
sqlite,
|
|
|
|
libjpeg,
|
|
|
|
speex,
|
|
|
|
pcre,
|
|
|
|
libuuid,
|
|
|
|
ldns,
|
|
|
|
libedit,
|
|
|
|
yasm,
|
|
|
|
which,
|
|
|
|
libsndfile,
|
|
|
|
libtiff,
|
|
|
|
libxcrypt,
|
2020-06-05 18:01:13 +00:00
|
|
|
callPackage,
|
2020-01-01 16:00:02 +00:00
|
|
|
SystemConfiguration,
|
2020-01-01 21:07:45 +00:00
|
|
|
modules ? null,
|
2020-05-11 14:02:16 +00:00
|
|
|
nixosTests,
|
2020-01-01 16:00:02 +00:00
|
|
|
}:
|
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
let
|
|
|
|
|
2020-06-05 18:01:13 +00:00
|
|
|
availableModules = callPackage ./modules.nix { };
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-08-04 09:34:15 +00:00
|
|
|
# the default list from v1.8.7, except with applications/mod_signalwire also disabled
|
2019-02-11 17:14:43 +00:00
|
|
|
defaultModules =
|
|
|
|
mods:
|
|
|
|
with mods;
|
|
|
|
[
|
|
|
|
applications.commands
|
|
|
|
applications.conference
|
|
|
|
applications.db
|
|
|
|
applications.dptools
|
|
|
|
applications.enum
|
|
|
|
applications.esf
|
|
|
|
applications.expr
|
|
|
|
applications.fifo
|
|
|
|
applications.fsv
|
|
|
|
applications.hash
|
|
|
|
applications.httapi
|
|
|
|
applications.sms
|
|
|
|
applications.spandsp
|
|
|
|
applications.valet_parking
|
|
|
|
applications.voicemail
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
applications.curl
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
codecs.amr
|
|
|
|
codecs.b64
|
|
|
|
codecs.g723_1
|
|
|
|
codecs.g729
|
|
|
|
codecs.h26x
|
|
|
|
codecs.opus
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2020-01-01 21:07:45 +00:00
|
|
|
databases.mariadb
|
|
|
|
databases.pgsql
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
dialplans.asterisk
|
|
|
|
dialplans.xml
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
endpoints.loopback
|
|
|
|
endpoints.rtc
|
|
|
|
endpoints.skinny
|
|
|
|
endpoints.sofia
|
|
|
|
endpoints.verto
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
event_handlers.cdr_csv
|
|
|
|
event_handlers.cdr_sqlite
|
|
|
|
event_handlers.event_socket
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
formats.local_stream
|
|
|
|
formats.native_file
|
|
|
|
formats.png
|
|
|
|
formats.sndfile
|
|
|
|
formats.tone_stream
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
languages.lua
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
loggers.console
|
|
|
|
loggers.logfile
|
|
|
|
loggers.syslog
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
say.en
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
xml_int.cdr
|
|
|
|
xml_int.rpc
|
|
|
|
xml_int.scgi
|
2020-01-01 16:00:02 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [ endpoints.gsmopen ];
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2020-01-01 16:00:02 +00:00
|
|
|
enabledModules = (if modules != null then modules else defaultModules) availableModules;
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
modulesConf =
|
|
|
|
let
|
|
|
|
lst = builtins.map (mod: mod.path) enabledModules;
|
|
|
|
str = lib.strings.concatStringsSep "\n" lst;
|
|
|
|
in
|
|
|
|
builtins.toFile "modules.conf" str;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2011-01-21 22:12:34 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-01-01 21:07:45 +00:00
|
|
|
pname = "freeswitch";
|
2024-08-04 01:11:06 +00:00
|
|
|
version = "1.10.12";
|
2020-01-01 21:07:45 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "signalwire";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2024-08-04 01:11:06 +00:00
|
|
|
hash = "sha256-uOO+TpKjJkdjEp4nHzxcHtZOXqXzpkIF3dno1AX17d8=";
|
2011-01-21 22:12:34 +00:00
|
|
|
};
|
2020-09-03 01:48:40 +00:00
|
|
|
|
2017-09-16 10:08:08 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs libs/libvpx/build/make/rtcd.pl
|
|
|
|
substituteInPlace libs/libvpx/build/make/configure.sh \
|
|
|
|
--replace AS=\''${AS} AS=yasm
|
2020-06-05 16:39:51 +00:00
|
|
|
|
|
|
|
# Disable advertisement banners
|
|
|
|
for f in src/include/cc.h libs/esl/src/include/cc.h; do
|
|
|
|
{
|
|
|
|
echo 'const char *cc = "";'
|
|
|
|
echo 'const char *cc_s = "";'
|
|
|
|
} > $f
|
|
|
|
done
|
2017-09-16 10:08:08 +00:00
|
|
|
'';
|
2011-01-21 22:12:34 +00:00
|
|
|
|
2021-05-10 18:22:46 +00:00
|
|
|
strictDeps = true;
|
2021-05-10 14:23:54 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
autoreconfHook
|
|
|
|
perl
|
|
|
|
which
|
|
|
|
yasm
|
|
|
|
];
|
2016-08-24 23:23:03 +00:00
|
|
|
buildInputs =
|
|
|
|
[
|
2021-05-10 14:23:54 +00:00
|
|
|
openssl
|
|
|
|
ncurses
|
|
|
|
gnutls
|
|
|
|
readline
|
|
|
|
libjpeg
|
|
|
|
sqlite
|
|
|
|
pcre
|
|
|
|
speex
|
|
|
|
ldns
|
|
|
|
libedit
|
2019-02-11 17:17:56 +00:00
|
|
|
libsndfile
|
|
|
|
libtiff
|
2022-10-03 14:47:50 +00:00
|
|
|
libuuid
|
|
|
|
libxcrypt
|
2019-02-01 22:39:15 +00:00
|
|
|
]
|
2019-02-11 17:14:43 +00:00
|
|
|
++ lib.unique (lib.concatMap (mod: mod.inputs) enabledModules)
|
2019-02-01 22:39:15 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ SystemConfiguration ];
|
2011-01-21 22:12:34 +00:00
|
|
|
|
2020-01-07 14:52:31 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-Wno-error";
|
2014-11-28 17:40:19 +00:00
|
|
|
|
2022-09-20 13:02:55 +00:00
|
|
|
# Using c++14 because of build error
|
|
|
|
# gsm_at.h:94:32: error: ISO C++17 does not allow dynamic exception specifications
|
|
|
|
CXXFLAGS = "-std=c++14";
|
|
|
|
|
2021-10-31 10:40:58 +00:00
|
|
|
CFLAGS = "-D_ANSI_SOURCE";
|
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
hardeningDisable = [ "format" ];
|
2016-02-11 01:38:14 +00:00
|
|
|
|
2019-02-11 17:14:43 +00:00
|
|
|
preConfigure = ''
|
2020-01-01 21:07:45 +00:00
|
|
|
./bootstrap.sh
|
2019-02-11 17:14:43 +00:00
|
|
|
cp "${modulesConf}" modules.conf
|
|
|
|
'';
|
|
|
|
|
2019-02-12 15:54:36 +00:00
|
|
|
postInstall = ''
|
|
|
|
# helper for compiling modules... not generally useful; also pulls in perl dependency
|
|
|
|
rm "$out"/bin/fsxs
|
2020-01-07 14:52:31 +00:00
|
|
|
# include configuration templates
|
|
|
|
cp -r conf $out/share/freeswitch/
|
2019-02-12 15:54:36 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-11 14:02:16 +00:00
|
|
|
passthru.tests.freeswitch = nixosTests.freeswitch;
|
|
|
|
|
2011-01-21 22:12:34 +00:00
|
|
|
meta = {
|
|
|
|
description = "Cross-Platform Scalable FREE Multi-Protocol Soft Switch";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://freeswitch.org/";
|
2021-01-15 07:07:56 +00:00
|
|
|
license = lib.licenses.mpl11;
|
2023-12-22 20:10:35 +00:00
|
|
|
maintainers = with lib.maintainers; [ mikaelfangel ];
|
2021-01-15 07:07:56 +00:00
|
|
|
platforms = with lib.platforms; unix;
|
2023-02-04 11:00:56 +00:00
|
|
|
broken = stdenv.hostPlatform.isDarwin;
|
2011-01-21 22:12:34 +00:00
|
|
|
};
|
|
|
|
}
|