2 Commits

Author SHA1 Message Date
ec4c3897e2 clanService:phonebox: fax echo feature 2025-12-16 10:28:16 +07:00
39bfcd0080 nix fmt 2025-12-12 18:27:30 +07:00
2 changed files with 146 additions and 412 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -30,7 +30,12 @@
...
}:
let
asterisk = pkgs.asterisk.overrideAttrs (old: {
propagatedNativeBuildInputs = [ pkgs.spandsp3 ];
});
user = "asterisk";
faxDir = "/run/asterisk/fax";
rtpPortFrom = 10000;
rtpPortTo = 20000;
ata-interface = settings.ata-ethernet-iface;
@@ -191,6 +196,7 @@
services.asterisk = {
enable = lib.mkDefault true;
package = lib.mkDefault asterisk;
confFiles =
let
machines = lib.attrNames roles.default.machines;
@@ -240,6 +246,13 @@
syslog.local0 => notice,warning,error
'';
"modules.conf" = ''
[modules]
autoload=yes
load => res_fax_spandsp.so
'';
# Dial plan config
"extensions.conf" =
let
@@ -257,6 +270,16 @@
same => n,Playback(hello-world)
same => n,Hangup()
exten => 000,1,Answer()
same => n,ReceiveFAX(${faxDir}/echo-''${UNIQUEID}.tiff)
same => n,Set(FAXFILE=${faxDir}/echo-''${UNIQUEID}.tiff)
same => n,Set(FAXECHO=true)
exten => h,1,GotoIf($[''${FAXECHO}]?sendfax)
same => n,Hangup()
same => n(sendfax),Originate(PJSIP/00,app,SendFAX,${faxDir}/echo-''${UNIQUEID}.tiff)
same => n,Set(FAXECHO=false)
''
+ (genLocalExtenConf {
localNumber = config.clan.core.vars.generators.phonebox.files.ata-local-number.value;
@@ -318,6 +341,10 @@
};
};
systemd.tmpfiles.rules = [
"d ${faxDir} 0755 ${user} ${user} - -"
];
systemd.services.asterisk-watcher = {
enable = true;
description = "Asterisk Configuration files watcher";