Compare commits
11 Commits
mob/phoneb
...
0fba719518
| Author | SHA1 | Date | |
|---|---|---|---|
| 0fba719518 | |||
| f138507f34 | |||
| 7a60ac9546 | |||
| a65b6aed8c | |||
| cf192b0d97 | |||
| 480fc09fbe | |||
| 725cdca94f | |||
| abcd0dfa31 | |||
| e6b0c1f5f9 | |||
| 640cb2642d | |||
| a3f6cdbf68 |
@@ -109,12 +109,6 @@
|
|||||||
roles.default.machines."adhil".settings = {
|
roles.default.machines."adhil".settings = {
|
||||||
ata-ethernet-iface = "end0";
|
ata-ethernet-iface = "end0";
|
||||||
};
|
};
|
||||||
roles.default.machines."rigel".settings = {
|
|
||||||
extraClientNumbers = [
|
|
||||||
"01"
|
|
||||||
"02"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pocket-id = {
|
pocket-id = {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -14,11 +14,6 @@
|
|||||||
description = "An Ethernet interface that connect to ATA box.";
|
description = "An Ethernet interface that connect to ATA box.";
|
||||||
default = "enp2s0";
|
default = "enp2s0";
|
||||||
};
|
};
|
||||||
options.extraClientNumbers = lib.mkOption {
|
|
||||||
type = with lib.types; listOf str;
|
|
||||||
description = "List of client suffix number.";
|
|
||||||
default = [ ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
perInstance =
|
perInstance =
|
||||||
{
|
{
|
||||||
@@ -35,12 +30,7 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
asterisk = pkgs.asterisk.overrideAttrs (old: {
|
|
||||||
propagatedNativeBuildInputs = [ pkgs.spandsp3 ];
|
|
||||||
});
|
|
||||||
|
|
||||||
user = "asterisk";
|
user = "asterisk";
|
||||||
faxDir = "/run/asterisk/fax";
|
|
||||||
rtpPortFrom = 10000;
|
rtpPortFrom = 10000;
|
||||||
rtpPortTo = 20000;
|
rtpPortTo = 20000;
|
||||||
ata-interface = settings.ata-ethernet-iface;
|
ata-interface = settings.ata-ethernet-iface;
|
||||||
@@ -74,22 +64,6 @@
|
|||||||
max_contacts=1
|
max_contacts=1
|
||||||
'';
|
'';
|
||||||
|
|
||||||
genLocalSIPEndpointV6 =
|
|
||||||
{ localNumber }:
|
|
||||||
''
|
|
||||||
[${localNumber}](internal_endpoint)
|
|
||||||
transport=transport-udp6
|
|
||||||
aors=${localNumber}
|
|
||||||
auth=${localNumber}
|
|
||||||
|
|
||||||
[${localNumber}](userpass_auth)
|
|
||||||
username=${localNumber}
|
|
||||||
password=${localNumber}
|
|
||||||
|
|
||||||
[${localNumber}](dynamiic_aor)
|
|
||||||
max_contacts=1
|
|
||||||
'';
|
|
||||||
|
|
||||||
genLocalExtenConf =
|
genLocalExtenConf =
|
||||||
{ localNumber }:
|
{ localNumber }:
|
||||||
''
|
''
|
||||||
@@ -217,7 +191,6 @@
|
|||||||
|
|
||||||
services.asterisk = {
|
services.asterisk = {
|
||||||
enable = lib.mkDefault true;
|
enable = lib.mkDefault true;
|
||||||
package = lib.mkDefault asterisk;
|
|
||||||
confFiles =
|
confFiles =
|
||||||
let
|
let
|
||||||
machines = lib.attrNames roles.default.machines;
|
machines = lib.attrNames roles.default.machines;
|
||||||
@@ -267,13 +240,6 @@
|
|||||||
syslog.local0 => notice,warning,error
|
syslog.local0 => notice,warning,error
|
||||||
'';
|
'';
|
||||||
|
|
||||||
"modules.conf" = ''
|
|
||||||
[modules]
|
|
||||||
autoload=yes
|
|
||||||
|
|
||||||
load => res_fax_spandsp.so
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Dial plan config
|
# Dial plan config
|
||||||
"extensions.conf" =
|
"extensions.conf" =
|
||||||
let
|
let
|
||||||
@@ -291,23 +257,10 @@
|
|||||||
same => n,Playback(hello-world)
|
same => n,Playback(hello-world)
|
||||||
same => n,Hangup()
|
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 {
|
+ (genLocalExtenConf {
|
||||||
localNumber = config.clan.core.vars.generators.phonebox.files.ata-local-number.value;
|
localNumber = config.clan.core.vars.generators.phonebox.files.ata-local-number.value;
|
||||||
})
|
})
|
||||||
+ lib.concatStringsSep "\n" (
|
|
||||||
builtins.map (number: genLocalExtenConf { localNumber = number; }) settings.extraClientNumbers
|
|
||||||
)
|
|
||||||
+ serverConf;
|
+ serverConf;
|
||||||
|
|
||||||
"rtp.conf" = ''
|
"rtp.conf" = ''
|
||||||
@@ -339,7 +292,6 @@
|
|||||||
|
|
||||||
[base_endpoint](!)
|
[base_endpoint](!)
|
||||||
type=endpoint
|
type=endpoint
|
||||||
transport=transport-udp
|
|
||||||
disallow=all
|
disallow=all
|
||||||
allow=ulaw,alaw,g722,gsm
|
allow=ulaw,alaw,g722,gsm
|
||||||
direct_media=no
|
direct_media=no
|
||||||
@@ -362,17 +314,10 @@
|
|||||||
+ (genLocalSIPEndpoint {
|
+ (genLocalSIPEndpoint {
|
||||||
localNumber = config.clan.core.vars.generators.phonebox.files.ata-local-number.value;
|
localNumber = config.clan.core.vars.generators.phonebox.files.ata-local-number.value;
|
||||||
})
|
})
|
||||||
+ lib.concatStringsSep "\n" (
|
|
||||||
builtins.map (number: genLocalSIPEndpointV6 { localNumber = number; }) settings.extraClientNumbers
|
|
||||||
)
|
|
||||||
+ serverConf;
|
+ serverConf;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
|
||||||
"d ${faxDir} 0755 ${user} ${user} - -"
|
|
||||||
];
|
|
||||||
|
|
||||||
systemd.services.asterisk-watcher = {
|
systemd.services.asterisk-watcher = {
|
||||||
enable = true;
|
enable = true;
|
||||||
description = "Asterisk Configuration files watcher";
|
description = "Asterisk Configuration files watcher";
|
||||||
@@ -393,12 +338,6 @@
|
|||||||
asterisk -rx "pjsip reload"
|
asterisk -rx "pjsip reload"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
case "$file" in
|
|
||||||
extensions.conf)
|
|
||||||
echo "restarting core"
|
|
||||||
asterisk -rx "core restart now"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
00
|
|
||||||
Reference in New Issue
Block a user