about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/asterisk/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/asterisk/default.nix')
-rw-r--r--nixpkgs/pkgs/servers/asterisk/default.nix59
1 files changed, 44 insertions, 15 deletions
diff --git a/nixpkgs/pkgs/servers/asterisk/default.nix b/nixpkgs/pkgs/servers/asterisk/default.nix
index dddc7f42d884..eeefe0dcd14f 100644
--- a/nixpkgs/pkgs/servers/asterisk/default.nix
+++ b/nixpkgs/pkgs/servers/asterisk/default.nix
@@ -1,8 +1,11 @@
-{ stdenv, lib, fetchurl, fetchsvn,
+{ stdenv, lib, fetchurl, fetchsvn, fetchFromGitHub,
   jansson, libedit, libxml2, libxslt, ncurses, openssl, sqlite,
   util-linux, dmidecode, libuuid, newt,
-  lua, speex,
-  srtp, wget, curl, iksemel, pkg-config
+  lua, speex, libopus, opusfile, libogg,
+  srtp, wget, curl, iksemel, pkg-config,
+  autoconf, libtool, automake,
+  python39, writeScript,
+  withOpus ? true,
 }:
 
 let
@@ -13,8 +16,9 @@ let
     buildInputs = [ jansson libedit libxml2 libxslt ncurses openssl sqlite
                     dmidecode libuuid newt
                     lua speex
-                    srtp wget curl iksemel ];
-    nativeBuildInputs = [ util-linux pkg-config ];
+                    srtp wget curl iksemel ]
+                  ++ lib.optionals withOpus [ libopus opusfile libogg ];
+    nativeBuildInputs = [ util-linux pkg-config autoconf libtool automake ];
 
     patches = [
       # We want the Makefile to install the default /var skeleton
@@ -22,7 +26,7 @@ let
       # This patch changes the runtime behavior to look for state
       # directories in /var rather than ${out}/var.
       ./runtime-vardirs.patch
-    ];
+    ] ++ lib.optional withOpus "${asterisk-opus}/asterisk.patch";
 
     postPatch = ''
       echo "PJPROJECT_CONFIG_OPTS += --prefix=$out" >> third-party/pjproject/Makefile.rules
@@ -49,6 +53,12 @@ let
       ${lib.optionalString (externals ? "addons/mp3") "bash contrib/scripts/get_mp3_source.sh || true"}
 
       chmod -w externals_cache
+      ${lib.optionalString withOpus ''
+        cp ${asterisk-opus}/include/asterisk/* ./include/asterisk
+        cp ${asterisk-opus}/codecs/* ./codecs
+        cp ${asterisk-opus}/formats/* ./formats
+      ''}
+      ./bootstrap.sh
     '';
 
     configureFlags = [
@@ -63,6 +73,10 @@ let
       ${lib.optionalString (externals ? "addons/mp3") ''
         substituteInPlace menuselect.makeopts --replace 'format_mp3 ' ""
       ''}
+      ${lib.optionalString withOpus ''
+        substituteInPlace menuselect.makeopts --replace 'codec_opus_open_source ' ""
+        substituteInPlace menuselect.makeopts --replace 'format_ogg_opus_open_source ' ""
+      ''}
     '';
 
     postInstall = ''
@@ -79,9 +93,9 @@ let
     };
   };
 
-  pjproject_2_10 = fetchurl {
-    url = "https://raw.githubusercontent.com/asterisk/third-party/master/pjproject/2.10/pjproject-2.10.tar.bz2";
-    sha256 = "14qmddinm4bv51rl0wwg5133r64x5bd6inwbx27ahb2n0151m2if";
+  pjproject_2_12 = fetchurl {
+    url = "https://raw.githubusercontent.com/asterisk/third-party/master/pjproject/2.12/pjproject-2.12.tar.bz2";
+    hash = "sha256-T3q4r/4WCAZCNGnULxMnNKH9wEK7gkseV/sV8IPasHQ=";
   };
 
   mp3-202 = fetchsvn {
@@ -90,27 +104,42 @@ let
     sha256 = "1s9idx2miwk178sa731ig9r4fzx4gy1q8xazfqyd7q4lfd70s1cy";
   };
 
+  asterisk-opus = fetchFromGitHub {
+    owner = "traud";
+    repo = "asterisk-opus";
+    # No releases, points to master as of 2022-04-06
+    rev = "a959f072d3f364be983dd27e6e250b038aaef747";
+    sha256 = "sha256-CASlTvTahOg9D5jccF/IN10LP/U8rRy9BFCSaHGQfCw=";
+  };
+
   # auto-generated by update.py
   versions = lib.mapAttrs (_: {version, sha256}: common {
     inherit version sha256;
     externals = {
-      "externals_cache/pjproject-2.10.tar.bz2" = pjproject_2_10;
+      "externals_cache/pjproject-2.12.tar.bz2" = pjproject_2_12;
       "addons/mp3" = mp3-202;
     };
   }) (lib.importJSON ./versions.json);
 
+  updateScript_python = python39.withPackages (p: with p; [ packaging beautifulsoup4 requests ]);
+  updateScript = writeScript "asterisk-update" ''
+    #!/usr/bin/env bash
+    exec ${updateScript_python}/bin/python ${toString ./update.py}
+  '';
+
 in {
-  # Supported releases (as of 2020-10-26).
+  # Supported releases (as of 2022-04-05).
   # Source: https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions
   # Exact version can be found at https://www.asterisk.org/downloads/asterisk/all-asterisk-versions/
   #
   # Series  Type       Rel. Date   Sec. Fixes  EOL
-  # 13.x    LTS        2014-10-24  2020-10-24  2021-10-24
   # 16.x    LTS        2018-10-09  2022-10-09  2023-10-09
-  # 17.x    Standard   2019-10-28  2020-10-28  2021-10-28
   # 18.x    LTS        2020-10-20  2024-10-20  2025-10-20
+  # 19.x    Standard   2021-11-02  2022-11-02  2023-11-02
   asterisk-lts = versions.asterisk_18;
-  asterisk-stable = versions.asterisk_18;
-  asterisk = versions.asterisk_18;
+  asterisk-stable = versions.asterisk_19;
+  asterisk = versions.asterisk_19.overrideAttrs (o: {
+    passthru = (o.passthru or {}) // { inherit updateScript; };
+  });
 
 } // versions