FusionPBX: now with 90% more apps!

This commit is contained in:
kat witch 2021-08-15 21:46:32 +01:00
parent 96ec670b6d
commit 172e1a95cd
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
4 changed files with 91 additions and 12 deletions

View file

@ -14,7 +14,7 @@ let
else psql_base;
freeSwitchConfig = pkgs.writeShellScriptBin "copy_config" ''
set -exu
if [ ! -f "${cfg.home}/state/installed" ]; then
if [[ ! -f "${cfg.home}/state/installed" ]]; then
mkdir -p /etc/freeswitch
cp --no-preserve=mode,ownership -r ${cfg.package}/resources/templates/conf/* /etc/freeswitch
fi
@ -22,15 +22,7 @@ let
installerReplacement = pkgs.writeShellScriptBin "installer_replacement" ''
set -exu
if [ -f "${cfg.home}/state/installed" ]; then
if [ -f "${cfg.home}/state/lastversion" ]; then
lastversion=$(<${cfg.home}/state/lastversion)
if [ lastversion != "${cfg.package.version}" ]; then
${php} ${cfg.package}/core/upgrade/upgrade_schema.php
echo "${cfg.package.version}" >| ${cfg.home}/state/lastversion
fi
fi
else
if [[ ! -f "${cfg.home}/state/installed" ]]; then
mkdir -p /var/lib/fusionpbx
${if ! cfg.useLocalPostgreSQL then "PGPASSWORD=${cfg.postgres.db_password}" else ""}
@ -58,7 +50,7 @@ user_group_uuid=$(${php} ${cfg.package}/resources/uuid.php);
xml_cdr_password=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64 | sed 's/[=\+//]//g')
sed -i /etc/freeswitch/autoload_configs/xml_cdr.conf.xml -e s:"{v_http_protocol}:http:"
sed -i /etc/freeswitch/autoload_configs/xml_cdr.conf.xml -e s:"{v_project_path}::"
sed -i /etc/freeswitch/autoload_configs/xml_cdr.conf.xml -e s:"127.0.0.1:${cfg.domain}"
sed -i /etc/freeswitch/autoload_configs/xml_cdr.conf.xml -e s:"http:\/\/127.0.0.1:https:\/\/${cfg.domain}"
sed -i /etc/freeswitch/autoload_configs/xml_cdr.conf.xml -e s:"{v_user}:$xml_cdr_username:"
sed -i /etc/freeswitch/autoload_configs/xml_cdr.conf.xml -e s:"{v_pass}:$xml_cdr_password:"

View file

@ -37,7 +37,7 @@
hardphones = true;
useACMEHost = "services_fusionpbx";
domain = "pbx.${config.network.dns.domain}";
package = with pkgs; fusionpbx;
package = with pkgs; fusionpbxWithApps [ fusionpbx-apps.sms ];
freeSwitchPackage = with pkgs; freeswitch;
};
}

View file

@ -92,6 +92,13 @@ let
fusionpbx = self.callPackage ./fusionpbx { };
fusionpbx-apps = self.callPackage ./fusionpbx-apps { };
fusionpbxWithApps = apps: self.symlinkJoin {
inherit (self.fusionpbx) version name;
paths = [ self.fusionpbx ] ++ apps;
};
} // super.lib.optionalAttrs (builtins.pathExists ../config/trusted/pkgs)
(import ../config/trusted/pkgs { inherit super self; });
pkgs = import sources.nixpkgs {

View file

@ -0,0 +1,80 @@
{
lib,
stdenv,
fetchFromGitHub
}:
stdenv.mkDerivation rec {
pname = "fusionpbx-apps";
version = "master";
src = fetchFromGitHub {
owner = "fusionpbx";
repo = pname;
rev = "c0eb1c852332a8ba3010e54cd1ac634c47f832fb";
sha256 = "0gqlzzd2m2g2njxqr1kd7bcy3wi4irv7i5njqa8d8iiwwmnvbb4r";
};
apps = [
"active_extensions"
"backup"
"bdr"
"bulk_account_settings"
"bulk_import_extensions"
"call_acl"
"cdr"
"content"
"domain_counts"
"fifo_agents"
"get_call_details"
"help"
"invoices"
"languages"
"mobile_twinning"
"php_service"
"profiles"
"roku"
"schemas"
"school_bells"
"servers"
"services"
"sessiontalk"
"sipjs"
"sipml5"
"sms"
"soft_phone"
"tickets"
"users_bulk_add"
"voicemail_msgs"
"voicemail_status"
"webrtc"
"xmpp"
"zoiper"
];
outputs = lib.singleton "out" ++ apps;
postPatch = ''
mv mobile-twinning mobile_twinning
'';
installPhase = ''
mkdir $out
for app in $apps; do
mkdir -p ''${!app}/app
mv $app ''${!app}/app/
if [[ -d ''${app}/resources/install/scripts/app ]]; then
mkdir -p ''${!app}/app/scripts/resources/scripts/app
ln -s ''${!app}/resources/install/scripts/app/* ''${!app}/app/scripts/resources/scripts/app/
fi
done
'';
meta = with lib; {
description = "Applications for FusionPBX.";
homepage = "https://www.fusionpbx.com/";
license = with licenses; mpl11;
maintainers = with maintainers; [ kittywitch ];
platforms = with platforms; unix;
};
}