Add asterisk test service
This commit is contained in:
parent
fbd94fb3f9
commit
32aa08d39c
4 changed files with 129 additions and 3 deletions
|
|
@ -67,9 +67,10 @@ in {
|
|||
same = n,Hangup()
|
||||
|
||||
exten = _499846977891,1,Noop(Processing an incoming call)
|
||||
same = n,Dial(PJSIP/13&PJSIP/16,30,tT)
|
||||
same = n,VoiceMail(977891@jakob,u)
|
||||
same = n,Hangup()
|
||||
same = n,VoiceMail(876@lechner,uS)
|
||||
;same = n,Dial(PJSIP/13&PJSIP/16,30,tT)
|
||||
;same = n,VoiceMail(977891@jakob,u)
|
||||
;same = n,Hangup()
|
||||
|
||||
[dect]
|
||||
exten = 100,1,Answer()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../../home-manager/users/jalr.nix
|
||||
./services
|
||||
];
|
||||
|
||||
networking = {
|
||||
|
|
|
|||
119
hosts/cadmium/services/asterisk.nix
Normal file
119
hosts/cadmium/services/asterisk.nix
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
rtp = {
|
||||
start = 10000;
|
||||
end = 10200;
|
||||
};
|
||||
in
|
||||
{
|
||||
services.asterisk = {
|
||||
enable = true;
|
||||
confFiles = {
|
||||
"features.conf" = ''
|
||||
[applicationmap]
|
||||
doorOpen => #9,peer,Gosub,"door-open,s,1"
|
||||
'';
|
||||
"extensions.conf" = ''
|
||||
[door-open]
|
||||
exten => s,1,Verbose("Here we are in a subroutine!")
|
||||
same = n,System("/tmp/door-open.sh")
|
||||
same = n,Hangup()
|
||||
|
||||
[doorbell]
|
||||
exten = s,1,Set(CHANNEL(hangup_handler_push)=hdlr1,s,1(args));
|
||||
same = n,Set(__DYNAMIC_FEATURES=doorOpen)
|
||||
same = n,Dial(PJSIP/1000,60)
|
||||
same = n,Hangup()
|
||||
|
||||
[hdlr1]
|
||||
exten = s,1,Verbose(0, Executed First)
|
||||
same = n,Playback(hello-world)
|
||||
same => n,Set(HANGUPCAUSE_STRING=''${HANGUPCAUSE_KEYS()})
|
||||
same = n,Verbose(0, Channels with hangup cause information: ''${HANGUPCAUSE_STRING})
|
||||
same = n,Set(ARRAY(item)=''${HANGUPCAUSE_STRING})
|
||||
same = n,Set(HANGUPCAUSE_STRING=''${HANGUPCAUSE_STRING:''${LEN(''${item})}})
|
||||
same = n,Verbose(0, Got Channel ID ''${item} with Technology Cause Code ''${HANGUPCAUSE(''${item},tech)}, Asterisk Cause Code ''${HANGUPCAUSE(''${item},ast)})
|
||||
same = n,Return()
|
||||
|
||||
[test]
|
||||
exten = 10,1,Answer()
|
||||
same = n,Wait(1)
|
||||
same = n,Playback(hello-world)
|
||||
same = n,Hangup()
|
||||
|
||||
exten = 11,1,Answer()
|
||||
same = n,AudioSocket(c81c42bb-d640-49b1-936b-989607d1985f,127.0.0.1:9092)
|
||||
same = n,Hangup()
|
||||
|
||||
exten = 12,1,Answer()
|
||||
;same = n,Festival(‘Please record your message’)
|
||||
same = n,Record(mymessage:gsm)
|
||||
;same = n,Festival(‘You said’)
|
||||
same = n,Playback(mymessage)
|
||||
;same = n,Festival(‘Press 1 to continue or 2 to change your message’)
|
||||
same = n,Read(KEEPORTOSS||1)
|
||||
|
||||
'';
|
||||
"http.conf" = ''
|
||||
[general]
|
||||
enabled=yes
|
||||
bindaddr=127.0.0.1
|
||||
|
||||
; Port to bind to for HTTP sessions (default is 8088)
|
||||
;bindport=8088
|
||||
|
||||
tlsdisablev1=yes
|
||||
tlsdisablev11=yes
|
||||
tlsdisablev12=yes
|
||||
|
||||
tlsservercipherorder=yes
|
||||
'';
|
||||
"rtp.conf" = ''
|
||||
[general]
|
||||
rtpstart=${toString rtp.start}
|
||||
rtpend=${toString rtp.end}
|
||||
'';
|
||||
"dnsmgr.conf" = ''
|
||||
[general]
|
||||
enable=yes
|
||||
refreshinterval=300
|
||||
'';
|
||||
"pjsip.conf" = ''
|
||||
[simpletrans]
|
||||
type=transport
|
||||
protocol=udp
|
||||
bind=127.0.0.1:5070
|
||||
|
||||
[1000]
|
||||
type=endpoint
|
||||
context=test
|
||||
disallow=all
|
||||
allow=alaw
|
||||
auth=1000
|
||||
aors=1000
|
||||
direct_media=no
|
||||
language=de
|
||||
|
||||
[1000]
|
||||
type=auth
|
||||
auth_type=userpass
|
||||
password=1000
|
||||
username=1000
|
||||
|
||||
[1000]
|
||||
type=aor
|
||||
max_contacts=1
|
||||
'';
|
||||
};
|
||||
useTheseDefaultConfFiles = [ ];
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
allowedUDPPortRanges = [
|
||||
{
|
||||
from = rtp.start;
|
||||
to = rtp.end;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
5
hosts/cadmium/services/default.nix
Normal file
5
hosts/cadmium/services/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./asterisk.nix
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue