70 lines
1.6 KiB
Nix
70 lines
1.6 KiB
Nix
{ ... }:
|
|
{
|
|
_class = "clan.service";
|
|
manifest.name = "asterisk";
|
|
manifest.description = "Asterisk PBX server";
|
|
manifest.categories = [ "System" ];
|
|
|
|
roles.default = {
|
|
perInstance.nixosModule =
|
|
{
|
|
lib,
|
|
...
|
|
}:
|
|
{
|
|
services.asterisk = {
|
|
enable = lib.mkDefault true;
|
|
confFiles = {
|
|
# Dial plan config
|
|
"extensions.conf" = ''
|
|
exten => 1001,1,Dial(PJSIP/user1,20)
|
|
exten => 1002,1,Dial(PJSIP/user2,20)
|
|
|
|
exten => 100,1,Answer()
|
|
same => n,Wait(1)
|
|
same => n,Playback(hello-world)
|
|
same => n,Hangup()
|
|
'';
|
|
|
|
"pjsip.conf" = ''
|
|
[transport-udp]
|
|
type=transport
|
|
protocol=udp
|
|
bind=0.0.0.0,[::]
|
|
|
|
[endpoint_internal](!)
|
|
type=endpoint
|
|
context=from-internal
|
|
disallow=all
|
|
allow=ulaw
|
|
|
|
[auth_userpass](!)
|
|
type=auth
|
|
auth_type=userpass
|
|
|
|
[aor_dynamic](!)
|
|
type=aor
|
|
max_contacts=1
|
|
|
|
[user1](endpoint_internal)
|
|
auth=user1
|
|
aors=user1
|
|
[user1](auth_userpass)
|
|
password=user1
|
|
username=user1
|
|
[user1](aor_dynamic)
|
|
|
|
[user2](endpoint_internal)
|
|
auth=user2
|
|
aors=user2
|
|
[user2](auth_userpass)
|
|
password=user2
|
|
username=user2
|
|
[user2](aor_dynamic)
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|