diff --git a/modules/voip/asterisk/default.nix b/modules/voip/asterisk/default.nix
index 065f7b1..f92c232 100644
--- a/modules/voip/asterisk/default.nix
+++ b/modules/voip/asterisk/default.nix
@@ -29,6 +29,7 @@ let
extensionInfo = lib.mapAttrs (_ext: keys:
let sample = allPhones.${lib.head keys}; in {
inherit keys;
+ personKey = sample.personKey;
mailboxExt = sample.mailboxExt;
ringTimeout =
if sample.personKey != null
@@ -272,6 +273,12 @@ let
else "exten => ${ext},1,Dial(${dialStr},${toString info.ringTimeout})"
) extensionInfo)
+ # BLF hints for person extensions
+ + "\n" + lib.concatStringsSep "\n" (lib.mapAttrsToList (ext: info:
+ lib.optionalString (info.personKey != null)
+ "exten => ${ext},hint,${lib.concatStringsSep "&" (map (k: "PJSIP/${k}") info.keys)}"
+ ) extensionInfo)
+
# Page and app extensions from cfg.extensions
+ "\n" + lib.concatStringsSep "\n" (lib.mapAttrsToList (ext: extCfg:
if extCfg.mode == "page"
diff --git a/modules/voip/provisioning/default.nix b/modules/voip/provisioning/default.nix
index 6609c38..ba502dc 100644
--- a/modules/voip/provisioning/default.nix
+++ b/modules/voip/provisioning/default.nix
@@ -43,9 +43,16 @@ pkgs.linkFarm "voip-tftp-root" (
familyLineEnabled = hasTrunk && phone.personKey != null && phone.sharedLine;
intercomLineIndex = if familyLineEnabled then 3 else 2;
+ # BLF targets: all persons except the one owning this phone
+ blfPersons = lib.filter (p: p.extension != phone.extension)
+ (lib.mapAttrsToList (_: person: {
+ inherit (person) extension displayName;
+ }) cfg.persons);
+
files = t.mkFiles ({
mac = key;
inherit (phone) label password displayName;
+ inherit blfPersons;
serverAddress = cfg.serverAddress;
ntpServer = cfg.ntpServer;
sipPort = cfg.sipPort;
diff --git a/modules/voip/provisioning/templates/cisco-8961.nix b/modules/voip/provisioning/templates/cisco-8961.nix
index 21fb31e..ebb2a5a 100644
--- a/modules/voip/provisioning/templates/cisco-8961.nix
+++ b/modules/voip/provisioning/templates/cisco-8961.nix
@@ -23,6 +23,7 @@ in {
, hasTrunk ? false
, hasIntercomButton ? false
, pageExtension ? null
+ , blfPersons ? []
}:
let
# Line button assignments:
@@ -30,6 +31,7 @@ in {
# button 2 / lineIndex 2 — family L2 line (when familyLineEnabled)
# button N / lineIndex N — intercom (when intercomEnabled; N = 2 or 3)
intercomButton = if familyLineEnabled then 3 else 2;
+ firstBlfButton = 1 + (if familyLineEnabled then 1 else 0) + (if intercomEnabled then 1 else 0) + 1;
dialplanFile = cisco.dialplanFilename mac;
@@ -173,7 +175,14 @@ in {
1
${mac}-intercom
- '' else ""}
+ '' else ""}${lib.concatImapStrings (i: p: ''
+
+ 21
+ ${p.displayName}
+ 1
+ ${p.extension}
+
+ '') blfPersons}
${toString sipPort}
16348
20134
@@ -253,7 +262,7 @@ in {
# as digits match a pattern with timeout="0", or after the timeout for
# timeout > 0. Explicit patterns must come before the catch-all.
h = builtins.hashString "sha256" (builtins.toJSON {
- inherit mac allExtensions allStarExtensions hasTrunk hasIntercomButton intercomLineIndex;
+ inherit mac allExtensions allStarExtensions hasTrunk hasIntercomButton intercomLineIndex blfPersons;
});
versionStamp = "${builtins.substring 0 8 h}-${builtins.substring 8 4 h}-${builtins.substring 12 4 h}-${builtins.substring 16 4 h}-${builtins.substring 20 12 h}";
extMatch = ext: " ";