2022-07-16 21:32:14 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
{
|
2022-07-21 09:22:40 +02:00
|
|
|
sops.secrets.ommpassword = {};
|
|
|
|
sops.secrets.sipsecret = {};
|
|
|
|
|
2022-07-16 21:32:14 +02:00
|
|
|
services.fieldpoc = {
|
|
|
|
enable = true;
|
2022-07-21 09:22:40 +02:00
|
|
|
ommIp = "10.42.132.2";
|
|
|
|
ommUser = "omm";
|
|
|
|
ommPasswordPath = config.sops.secrets.ommpassword.path;
|
|
|
|
sipsecretPath = config.sops.secrets.sipsecret.path;
|
2022-07-16 21:32:14 +02:00
|
|
|
dhcp = {
|
|
|
|
enable = true;
|
|
|
|
interface = "vlan132";
|
|
|
|
subnet = "10.42.132.0/24";
|
|
|
|
pool = "10.42.132.200 - 10.42.132.250";
|
|
|
|
router = "10.42.132.1";
|
|
|
|
dnsServers = "10.42.10.8";
|
2022-07-20 09:07:32 +02:00
|
|
|
omm = "10.42.132.2";
|
2022-07-16 21:32:14 +02:00
|
|
|
reservations = [
|
2022-07-20 09:07:32 +02:00
|
|
|
{
|
|
|
|
name = "omm";
|
|
|
|
macAddress = "AA:C3:A9:26:1F:77";
|
|
|
|
ipAddress = "10.42.132.2";
|
|
|
|
}
|
2022-07-16 21:32:14 +02:00
|
|
|
{
|
|
|
|
name = "rfp-01";
|
|
|
|
macAddress = "00:30:42:1B:8C:7A";
|
|
|
|
ipAddress = "10.42.132.11";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2022-07-20 09:07:32 +02:00
|
|
|
|
|
|
|
services.yate.config = {
|
|
|
|
accfile.dialout = {
|
|
|
|
enabled = "yes";
|
|
|
|
protocol = "sip";
|
|
|
|
username = "yate";
|
|
|
|
password = "yate";
|
|
|
|
registrar = "yate-dialup.bula22.de";
|
|
|
|
};
|
|
|
|
regexroute = "[default]
|
|
|
|
\${username}^$=-;error=noauth
|
|
|
|
^yate$=goto dialin
|
|
|
|
^.*$=line/\\0;line=dialout
|
|
|
|
|
|
|
|
[dialin]
|
|
|
|
\${sip_x-called}^.*$=lateroute/\\1";
|
2022-07-24 17:33:42 +02:00
|
|
|
ysipchan = {
|
|
|
|
general = {
|
|
|
|
ignorevia = "yes";
|
|
|
|
};
|
|
|
|
#"listener general".enable = "no";
|
|
|
|
#"listener dect" = {
|
|
|
|
# type = "udp";
|
|
|
|
# addr = "10.42.132.1";
|
|
|
|
# port = "5060";
|
|
|
|
#};
|
|
|
|
#"listener sip" = {
|
|
|
|
# type = "udp";
|
|
|
|
# addr = "10.42.133.1";
|
|
|
|
# port = "5060";
|
|
|
|
#};
|
|
|
|
#"listener voip" = {
|
|
|
|
# type = "udp";
|
|
|
|
# addr = "10.42.10.6";
|
|
|
|
# port = "5060";
|
|
|
|
# default = "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-21 00:55:10 +02:00
|
|
|
|
2022-07-24 17:42:43 +02:00
|
|
|
networking.firewall.allowedUDPPorts = [ 161 ];
|
|
|
|
|
2022-07-21 00:55:10 +02:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
(writers.makePythonWriter python39 python39.pkgs "/bin/dect_claim" { libraries = [ python39.pkgs.python-yate ]; } (builtins.readFile ./dect_claim.py))
|
|
|
|
(runCommand "yintro.slin" {} ''
|
|
|
|
mkdir -p $out/share/sounds/yate
|
|
|
|
ln -s ${./yintro.slin} $out/share/sounds/yate/yintro.slin
|
|
|
|
'')
|
|
|
|
];
|
2022-07-21 09:22:40 +02:00
|
|
|
|
|
|
|
systemd.services.fieldpoc-nerd = {
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
startAt = "*-*-* *:*:00";
|
|
|
|
script = let
|
|
|
|
reloadScript = pkgs.writeText "reload" ''
|
|
|
|
spawn ${pkgs.inetutils}/bin/telnet localhost 9437
|
|
|
|
expect "> "
|
|
|
|
send "reload\n"
|
|
|
|
expect "> "
|
|
|
|
send "exit\n"
|
|
|
|
expect "disconnecting"
|
|
|
|
'';
|
|
|
|
in ''
|
|
|
|
${pkgs.curl}/bin/curl https://nerd.bula22.de/export.json\?event=1 > /etc/fieldpoc/extensions.json
|
|
|
|
|
|
|
|
${pkgs.expect}/bin/expect ${reloadScript}
|
|
|
|
'';
|
|
|
|
};
|
2022-07-16 21:32:14 +02:00
|
|
|
}
|