feat: add dysfunctional busy line buttons
This commit is contained in:
parent
31b0c5789a
commit
bf60fcce98
3 changed files with 25 additions and 2 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 {
|
|||
<busyTrigger>1</busyTrigger>
|
||||
<contact>${mac}-intercom</contact>
|
||||
</line>
|
||||
'' else ""} </sipLines>
|
||||
'' else ""}${lib.concatImapStrings (i: p: ''
|
||||
<line button="${toString (firstBlfButton + i - 1)}">
|
||||
<featureID>21</featureID>
|
||||
<featureLabel>${p.displayName}</featureLabel>
|
||||
<featureOptionMask>1</featureOptionMask>
|
||||
<speedDialNumber>${p.extension}</speedDialNumber>
|
||||
</line>
|
||||
'') blfPersons} </sipLines>
|
||||
<voipControlPort>${toString sipPort}</voipControlPort>
|
||||
<startMediaPort>16348</startMediaPort>
|
||||
<stopMediaPort>20134</stopMediaPort>
|
||||
|
|
@ -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: " <TEMPLATE match=\"${ext}\" timeout=\"0\" />";
|
||||
|
|
|
|||
Loading…
Reference in a new issue