From b14d1e3cf2f11ba83da23f815da2aace75a816ec Mon Sep 17 00:00:00 2001 From: Matthias Wimmer Date: Sun, 2 Jul 2023 00:21:29 +0200 Subject: [PATCH 1/2] maintainers: add Matthias Wimmer --- maintainers/maintainer-list.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 23e585871ace..db890d835a5c 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -10242,6 +10242,15 @@ githubId = 95194; name = "Mauricio Scheffer"; }; + mawis = { + email = "m@tthias.eu"; + github = "mawis"; + githubId = 2042030; + name = "Matthias Wimmer"; + keys = [{ + fingerprint = "CAEC A12D CE23 37A6 6DFD 17B0 7AC7 631D 70D6 C898"; + }]; + }; maxbrunet = { email = "max@brnt.mx"; github = "maxbrunet"; From cdab43d496307c346409f190383d90f9bb800c91 Mon Sep 17 00:00:00 2001 From: Matthias Wimmer Date: Sun, 2 Jul 2023 00:22:15 +0200 Subject: [PATCH 2/2] kamailio: init at 5.7.1 Created new package 'kamailio' which is a SIP server, that is able to handle thousands of call setups per second. It can be used to build large platforms for VoIP and realtime communictions - presence, WebRTC, Instant messaging and other applications. Closes #169350 --- pkgs/servers/sip/kamailio/default.nix | 76 +++++++++++++++++++ .../kamailio/test-kamailio-bin/default.nix | 24 ++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 102 insertions(+) create mode 100644 pkgs/servers/sip/kamailio/default.nix create mode 100644 pkgs/servers/sip/kamailio/test-kamailio-bin/default.nix diff --git a/pkgs/servers/sip/kamailio/default.nix b/pkgs/servers/sip/kamailio/default.nix new file mode 100644 index 000000000000..c4677e37f1f2 --- /dev/null +++ b/pkgs/servers/sip/kamailio/default.nix @@ -0,0 +1,76 @@ +{ callPackage +, fetchurl +, lib +, pkgs +, stdenv +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "kamailio"; + version = "5.7.1"; + + meta = { + description = "Fast and flexible SIP server, proxy, SBC, and load balancer"; + homepage = "https://www.kamailio.org/"; + license = lib.licenses.gpl2Only; + maintainers = with lib.maintainers; [ mawis ]; + platforms = lib.platforms.linux; + }; + + src = fetchurl { + url = "https://www.kamailio.org/pub/kamailio/5.7.1/src/kamailio-${finalAttrs.version}_src.tar.gz"; + hash = "sha256-TkrAj5ohwzJ959UvXNwaMmcIwTRowUitP9/UNQ8D1zw="; + }; + + buildInputs = with pkgs; [ + bison + flex + gnugrep + json_c.dev + libevent.dev + libxml2.dev + mariadb-connector-c.dev + pcre.dev + ]; + + nativeBuildInputs = with pkgs; [ + pkg-config + which + ]; + + configurePhase = '' + runHook preConfigure + + make PREFIX="$out" include_modules="db_mysql dialplan jsonrpcc json lcr presence presence_conference presence_dialoginfo presence_mwi presence_profile presence_reginfo presence_xml pua pua_bla pua_dialoginfo pua_json pua_reginfo pua_rpc pua_usrloc pua_xmpp regex rls xcap_client xcap_server" cfg + + runHook postConfigure + ''; + + buildPhase = '' + runHook preBuild + + make MYSQLCFG=${pkgs.mariadb-connector-c.dev}/bin/mariadb_config all + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + make MYSQLCFG=${pkgs.mariadb-connector-c.dev}/bin/mariadb_config install + echo 'MD5="${pkgs.coreutils}/bin/md5sum"' >> $out/etc/kamailio/kamctlrc + echo 'AWK="${pkgs.gawk}/bin/awk"' >> $out/etc/kamailio/kamctlrc + echo 'GDB="${pkgs.gdb}/bin/gdb"' >> $out/etc/kamailio/kamctlrc + echo 'GREP="${pkgs.gnugrep}/bin/grep "' >> $out/etc/kamailio/kamctlrc + echo 'EGREP="${pkgs.gnugrep}/bin/grep -E"' >> $out/etc/kamailio/kamctlrc + echo 'SED="${pkgs.gnused}/bin/sed"' >> $out/etc/kamailio/kamctlrc + echo 'LAST_LINE="${pkgs.coreutils}/bin/tail -n 1"' >> $out/etc/kamailio/kamctlrc + echo 'EXPR="${pkgs.gnugrep}/bin/expr"' >> $out/etc/kamailio/kamctlrc + + runHook postInstall + ''; + + passthru.tests = { + kamailio-bin = callPackage ./test-kamailio-bin {}; + }; +}) diff --git a/pkgs/servers/sip/kamailio/test-kamailio-bin/default.nix b/pkgs/servers/sip/kamailio/test-kamailio-bin/default.nix new file mode 100644 index 000000000000..5d6eea600959 --- /dev/null +++ b/pkgs/servers/sip/kamailio/test-kamailio-bin/default.nix @@ -0,0 +1,24 @@ +{ stdenv, kamailio }: + +stdenv.mkDerivation { + name = "kamailio-bin-test"; + meta.timeout = 60; + src = ./.; + + dontInstall = true; + + buildPhase = '' + mkdir $out + + ${kamailio}/bin/kamailio -v > $out/kamailio-stdout + ${kamailio}/bin/kamcmd -h > $out/kamcmd-stdout + (${kamailio}/bin/kamctl help || exit 0) > $out/kamctl-stdout + ''; + + doCheck = true; + checkPhase = '' + grep -q "version: kamailio" $out/kamailio-stdout || (echo "ERROR: kamailio cannot be run"; exit 1) + grep -q "version: kamcmd" $out/kamcmd-stdout || (echo "ERROR: kamcmd cannot be run"; exit 1) + grep -q "add a new subscriber" $out/kamctl-stdout || (echo "ERROR: kamctl cannot be run"; exit 1) + ''; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9357c0743388..557bc9d38fa0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25926,6 +25926,8 @@ with pkgs; jitsi-videobridge = callPackage ../servers/jitsi-videobridge { }; + kamailio = callPackage ../servers/sip/kamailio { }; + kanidm = callPackage ../servers/kanidm { }; kapowbang = callPackage ../servers/kapowbang { };