1
0
vcp-bula-nixfiles/hosts/yate-dialup/voip.nix

54 lines
1.4 KiB
Nix
Raw Normal View History

2022-07-17 23:01:55 +02:00
{ config, pkgs, lib, ... }:
{
services.yate = {
enable = true;
2022-07-20 09:07:32 +02:00
config = {
regfile.yate.password = "yate";
regexroute = "[default]
2022-07-25 09:26:14 +02:00
^4933921999799\\(.*\\)$=sip/sip:\\1@10.42.10.6
2022-07-20 09:07:32 +02:00
\${sip_x-dialout-allowed}^1$=goto dialout
[dialout]
\${username}^$=-;error=noauth
^.*$=sip/sip:\\0;line=sipgate;osip_P-Preferred-Identity=<sip:4933921999799\${caller}@sipconnect.sipgate.de>;caller=3400888t0;domain=sipconnect.sipgate.de;";
2022-07-24 17:33:42 +02:00
ysipchan.general = {
ignorevia = "yes";
};
2022-07-24 17:42:43 +02:00
ysnmpagent = {
general.port = 161;
snmp_v2.ro_community = "yate";
};
2022-07-20 09:07:32 +02:00
};
};
2022-07-24 17:42:43 +02:00
networking.firewall.allowedUDPPorts = [ 161 ];
2022-07-20 09:07:32 +02:00
sops.secrets.sipgate_password = {
owner = "yate";
restartUnits = [ "yate.service" ];
};
2022-07-24 17:33:42 +02:00
#networking.hosts."2001:ab7::9" = [ "sipconnect.sipgate.de" ];
2022-07-20 09:07:32 +02:00
systemd.services.yate = {
preStart = let
accfile = pkgs.writeText "accfile.conf" (lib.generators.toINI { } {
sipgate = {
enabled = "yes";
protocol = "sip";
username = "3400888t0";
authname = "3400888t0";
password = "!!sipgate_password!!";
registrar = "sipconnect.sipgate.de";
localaddress = "yes";
};
});
in ''
${pkgs.gnused}/bin/sed -e "s/!!sipgate_password!!/$(cat ${config.sops.secrets.sipgate_password.path})/g" ${accfile} > /etc/yate/accfile.conf
'';
serviceConfig.PermissionsStartOnly = true;
2022-07-17 23:01:55 +02:00
};
}