Add custom voicemail greeting

This commit is contained in:
Jakob Lechner 2023-11-22 14:49:58 +00:00
parent f0762b17c6
commit 92687c7e76
No known key found for this signature in database
GPG key ID: 996082EFB5906C10
4 changed files with 42 additions and 4 deletions

1
.gitattributes vendored
View file

@ -1,2 +1,3 @@
**/secrets/** filter=git-crypt diff=git-crypt
**/secrets.yaml diff=sops
*.wav filter=lfs diff=lfs merge=lfs -text

View file

@ -0,0 +1,9 @@
## custom voicemail greetings
Place `busy` and/or `unavail` file in users voicemail directory.
The file can be converted to the fitting format using sox
```bash
sox $input_file -t wav -b 16 -c 1 -r 8k -e signed-integer --endian little unavail.wav
```

View file

@ -11,8 +11,23 @@ let
start = builtins.elemAt ports.asterisk-rtp.udp.range 0;
end = builtins.elemAt ports.asterisk-rtp.udp.range 1;
};
in
{
voicemail-sounds = pkgs.callPackage ./voicemail-sounds { };
in {
systemd.services.asterisk-voicemail-sounds = {
wantedBy = ["asterisk.service"];
after = ["asterisk.service"];
script = ''
ln -sfn \
${voicemail-sounds}/unavail.wav \
/var/spool/asterisk/voicemail/lechner/876/unavail.wav
'';
restartTriggers = [voicemail-sounds];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
};
services.asterisk = {
enable = true;
confFiles = {
@ -30,7 +45,7 @@ in
[sipgate-in]
exten = _499846876,1,Noop(Processing an incoming call)
same = n,Dial(PJSIP/10&PJSIP/11,25,tT)
same = n,VoiceMail(876@lechner,u)
same = n,VoiceMail(876@lechner,uS)
same = n,Hangup()
exten => _4998469779781,1,Verbose(3,Incoming fax)
@ -155,7 +170,7 @@ in
sops.secrets = (lib.listToAttrs (map
(name: lib.nameValuePair "asterisk-${name}" {
sopsFile = ../secrets.yaml;
sopsFile = ../../secrets.yaml;
owner = config.users.users.asterisk.name;
})
secretConfigFiles));

View file

@ -0,0 +1,13 @@
{ lib, stdenvNoCC }:
stdenvNoCC.mkDerivation {
name = "voicemail-sounds";
src = ./.;
dontBuild = true;
installPhase = ''
mkdir $out
cp -r * $out
'';
}