Compare commits
No commits in common. "1de9a8ba91da4f556ce445f4c03de5fc525adc21" and "bf60fcce98ffd574f580107810c5d211f5d02908" have entirely different histories.
1de9a8ba91
...
bf60fcce98
6 changed files with 8 additions and 66 deletions
|
|
@ -147,7 +147,6 @@ in {
|
||||||
|
|
||||||
extensions = {
|
extensions = {
|
||||||
"*99" = { mode = "page"; displayName = "Durchsage an alle"; };
|
"*99" = { mode = "page"; displayName = "Durchsage an alle"; };
|
||||||
"*100" = { mode = "all"; displayName = "Alle rufen"; };
|
|
||||||
# custom app extension example:
|
# custom app extension example:
|
||||||
# "*00" = { mode = "app"; displayName = "Echo test"; app = "Echo()"; };
|
# "*00" = { mode = "app"; displayName = "Echo test"; app = "Echo()"; };
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -281,8 +281,8 @@ let
|
||||||
|
|
||||||
# Page and app extensions from cfg.extensions
|
# Page and app extensions from cfg.extensions
|
||||||
+ "\n" + lib.concatStringsSep "\n" (lib.mapAttrsToList (ext: extCfg:
|
+ "\n" + lib.concatStringsSep "\n" (lib.mapAttrsToList (ext: extCfg:
|
||||||
if extCfg.mode == "page" then "exten => ${ext},1,Page(${allPageEndpoints},i,120)"
|
if extCfg.mode == "page"
|
||||||
else if extCfg.mode == "all" then "exten => ${ext},1,Dial(${allL2Endpoints},30)"
|
then "exten => ${ext},1,Page(${allPageEndpoints},i,120)"
|
||||||
else "exten => ${ext},1,${extCfg.app}"
|
else "exten => ${ext},1,${extCfg.app}"
|
||||||
) cfg.extensions)
|
) cfg.extensions)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -331,9 +331,7 @@ let
|
||||||
<table>
|
<table>
|
||||||
<tr><th>Extension</th><th>Name</th><th>Type</th><th>Detail</th></tr>
|
<tr><th>Extension</th><th>Name</th><th>Type</th><th>Detail</th></tr>
|
||||||
${lib.concatStringsSep "\n" (lib.mapAttrsToList (ext: extCfg:
|
${lib.concatStringsSep "\n" (lib.mapAttrsToList (ext: extCfg:
|
||||||
let detail = if extCfg.mode == "page" then "all phones"
|
let detail = if extCfg.mode == "page" then "all phones" else extCfg.app; in
|
||||||
else if extCfg.mode == "all" then "all shared-line phones"
|
|
||||||
else extCfg.app; in
|
|
||||||
''<tr><td><code>${ext}</code></td><td>${extCfg.displayName}</td><td>${extCfg.mode}</td><td><code>${detail}</code></td></tr>''
|
''<tr><td><code>${ext}</code></td><td>${extCfg.displayName}</td><td>${extCfg.mode}</td><td><code>${detail}</code></td></tr>''
|
||||||
) cfg.extensions)}
|
) cfg.extensions)}
|
||||||
${lib.concatStringsSep "\n" (map (ic:
|
${lib.concatStringsSep "\n" (map (ic:
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ let
|
||||||
confFiles = import ./asterisk/default.nix { inherit lib cfg models allPhones intercomEntries mohDirs greetingDirs; };
|
confFiles = import ./asterisk/default.nix { inherit lib cfg models allPhones intercomEntries mohDirs greetingDirs; };
|
||||||
|
|
||||||
directory = import ./provisioning/directory.nix { inherit lib pkgs cfg allPhones intercomEntries; };
|
directory = import ./provisioning/directory.nix { inherit lib pkgs cfg allPhones intercomEntries; };
|
||||||
directoryJson = import ./provisioning/directory-json.nix { inherit lib pkgs cfg models allPhones; };
|
|
||||||
provisioningRoot = import ./provisioning/default.nix { inherit lib pkgs cfg models allPhones; };
|
provisioningRoot = import ./provisioning/default.nix { inherit lib pkgs cfg models allPhones; };
|
||||||
|
|
||||||
diagram = import ./dashboard.nix { inherit lib pkgs cfg models allPhones intercomEntries; };
|
diagram = import ./dashboard.nix { inherit lib pkgs cfg models allPhones intercomEntries; };
|
||||||
|
|
@ -88,7 +87,6 @@ in {
|
||||||
"= /directory.xml" = { alias = "${directory.menuFile}"; extraConfig = "default_type text/xml;"; };
|
"= /directory.xml" = { alias = "${directory.menuFile}"; extraConfig = "default_type text/xml;"; };
|
||||||
"= /directory-list.xml" = { alias = "${directory.listFile}"; extraConfig = "default_type text/xml;"; };
|
"= /directory-list.xml" = { alias = "${directory.listFile}"; extraConfig = "default_type text/xml;"; };
|
||||||
"= /intercom.xml" = { alias = "${directory.intercomFile}"; extraConfig = "default_type text/xml;"; };
|
"= /intercom.xml" = { alias = "${directory.intercomFile}"; extraConfig = "default_type text/xml;"; };
|
||||||
"= /contacts.json" = { alias = "${directoryJson}"; extraConfig = ''default_type application/json; add_header Access-Control-Allow-Origin "*";''; };
|
|
||||||
"/" = {
|
"/" = {
|
||||||
root = "${diagram.webRoot}";
|
root = "${diagram.webRoot}";
|
||||||
extraConfig = lib.optionalString (!hasRuntimeSecrets) "index index.html;";
|
extraConfig = lib.optionalString (!hasRuntimeSecrets) "index index.html;";
|
||||||
|
|
|
||||||
|
|
@ -315,12 +315,11 @@ in {
|
||||||
type = lib.types.attrsOf (lib.types.submodule {
|
type = lib.types.attrsOf (lib.types.submodule {
|
||||||
options = {
|
options = {
|
||||||
mode = lib.mkOption {
|
mode = lib.mkOption {
|
||||||
type = lib.types.enum [ "page" "all" "app" ];
|
type = lib.types.enum [ "page" "app" ];
|
||||||
default = "page";
|
default = "page";
|
||||||
description = ''
|
description = ''
|
||||||
Extension mode:
|
Extension mode:
|
||||||
- "page": one-way announcement to all intercom-capable phones
|
- "page": one-way announcement to all phones
|
||||||
- "all": two-way call ringing all shared-line phones (allL2Endpoints)
|
|
||||||
- "app": custom Asterisk dialplan application
|
- "app": custom Asterisk dialplan application
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
{ lib, pkgs, cfg, models, allPhones }:
|
|
||||||
|
|
||||||
let
|
|
||||||
# Does any provisioned phone on this extension support intercom?
|
|
||||||
extensionHasIntercom = ext:
|
|
||||||
lib.any (phone: phone.extension == ext && models.${phone.model}.hasIntercom)
|
|
||||||
(lib.attrValues allPhones);
|
|
||||||
|
|
||||||
personContacts = lib.mapAttrsToList (_key: person:
|
|
||||||
lib.filterAttrs (_: v: v != null) {
|
|
||||||
displayName = person.displayName;
|
|
||||||
extension = person.extension;
|
|
||||||
sipUsernames = lib.attrNames person.phones;
|
|
||||||
intercomExtension =
|
|
||||||
if cfg.intercomPrefix != null && extensionHasIntercom person.extension
|
|
||||||
then "${cfg.intercomPrefix}${person.extension}"
|
|
||||||
else null;
|
|
||||||
mailboxCheckExtension =
|
|
||||||
if person.mailbox then "*97" else null;
|
|
||||||
}
|
|
||||||
) cfg.persons;
|
|
||||||
|
|
||||||
sharedPhoneContacts = lib.mapAttrsToList (key: phone:
|
|
||||||
lib.filterAttrs (_: v: v != null) {
|
|
||||||
displayName = phone.displayName;
|
|
||||||
extension = phone.extension;
|
|
||||||
sipUsernames = [ key ];
|
|
||||||
intercomExtension =
|
|
||||||
if cfg.intercomPrefix != null && models.${phone.model}.hasIntercom
|
|
||||||
then "${cfg.intercomPrefix}${phone.extension}"
|
|
||||||
else null;
|
|
||||||
}
|
|
||||||
) cfg.sharedPhones;
|
|
||||||
|
|
||||||
specialExtensions = lib.mapAttrsToList (ext: extCfg: {
|
|
||||||
displayName = extCfg.displayName;
|
|
||||||
extension = ext;
|
|
||||||
mode = extCfg.mode;
|
|
||||||
}) cfg.extensions;
|
|
||||||
|
|
||||||
directory = {
|
|
||||||
version = 1;
|
|
||||||
contacts = personContacts ++ sharedPhoneContacts;
|
|
||||||
specialExtensions = specialExtensions;
|
|
||||||
} // lib.optionalAttrs (cfg.sharedMailbox != null) {
|
|
||||||
sharedMailbox = {
|
|
||||||
inherit (cfg.sharedMailbox) displayName checkExtension;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
in
|
|
||||||
pkgs.writeText "contacts.json" (builtins.toJSON directory)
|
|
||||||
Loading…
Reference in a new issue