1 { config, lib, pkgs, ... }:
7 cfg = config.services.siproxd;
13 if_inbound = ${cfg.ifInbound}
14 if_outbound = ${cfg.ifOutbound}
15 sip_listen_port = ${toString cfg.sipListenPort}
16 rtp_port_low = ${toString cfg.rtpPortLow}
17 rtp_port_high = ${toString cfg.rtpPortHigh}
18 rtp_dscp = ${toString cfg.rtpDscp}
19 sip_dscp = ${toString cfg.sipDscp}
20 ${optionalString (cfg.hostsAllowReg != []) "hosts_allow_reg = ${concatStringsSep "," cfg.hostsAllowReg}"}
21 ${optionalString (cfg.hostsAllowSip != []) "hosts_allow_sip = ${concatStringsSep "," cfg.hostsAllowSip}"}
22 ${optionalString (cfg.hostsDenySip != []) "hosts_deny_sip = ${concatStringsSep "," cfg.hostsDenySip}"}
23 ${if (cfg.passwordFile != "") then "proxy_auth_pwfile = ${cfg.passwordFile}" else ""}
27 confFile = builtins.toFile "siproxd.conf" conf;
40 description = lib.mdDoc ''
41 Whether to enable the Siproxd SIP
42 proxy/masquerading daemon.
46 ifInbound = mkOption {
49 description = lib.mdDoc "Local network interface";
52 ifOutbound = mkOption {
55 description = lib.mdDoc "Public network interface";
58 hostsAllowReg = mkOption {
59 type = types.listOf types.str;
61 example = [ "192.168.1.0/24" "192.168.2.0/24" ];
62 description = lib.mdDoc ''
63 Acess control list for incoming SIP registrations.
67 hostsAllowSip = mkOption {
68 type = types.listOf types.str;
70 example = [ "123.45.0.0/16" "123.46.0.0/16" ];
71 description = lib.mdDoc ''
72 Acess control list for incoming SIP traffic.
76 hostsDenySip = mkOption {
77 type = types.listOf types.str;
79 example = [ "10.0.0.0/8" "11.0.0.0/8" ];
80 description = lib.mdDoc ''
81 Acess control list for denying incoming
82 SIP registrations and traffic.
86 sipListenPort = mkOption {
89 description = lib.mdDoc ''
90 Port to listen for incoming SIP messages.
94 rtpPortLow = mkOption {
97 description = lib.mdDoc ''
98 Bottom of UDP port range for incoming and outgoing RTP traffic
102 rtpPortHigh = mkOption {
105 description = lib.mdDoc ''
106 Top of UDP port range for incoming and outgoing RTP traffic
110 rtpTimeout = mkOption {
113 description = lib.mdDoc ''
114 Timeout for an RTP stream. If for the specified
115 number of seconds no data is relayed on an active
116 stream, it is considered dead and will be killed.
123 description = lib.mdDoc ''
124 DSCP (differentiated services) value to be assigned
125 to RTP packets. Allows QOS aware routers to handle
126 different types traffic with different priorities.
133 description = lib.mdDoc ''
134 DSCP (differentiated services) value to be assigned
135 to SIP packets. Allows QOS aware routers to handle
136 different types traffic with different priorities.
140 passwordFile = mkOption {
143 description = lib.mdDoc ''
144 Path to per-user password file.
148 extraConfig = mkOption {
151 description = lib.mdDoc ''
152 Extra configuration to add to siproxd configuration.
162 config = mkIf cfg.enable {
164 users.users.siproxyd = {
165 uid = config.ids.uids.siproxd;
168 systemd.services.siproxd = {
169 description = "SIP proxy/masquerading daemon";
170 wantedBy = [ "multi-user.target" ];
171 after = [ "network.target" ];
173 ExecStart = "${pkgs.siproxd}/sbin/siproxd -c ${confFile}";