summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--abbenay/asterisk.nix72
1 files changed, 72 insertions, 0 deletions
diff --git a/abbenay/asterisk.nix b/abbenay/asterisk.nix
new file mode 100644
index 0000000..f8a4d12
--- /dev/null
+++ b/abbenay/asterisk.nix
@@ -0,0 +1,72 @@
+{ config, lib, pkgs, ... }:
+
+{
+
+ networking.firewall.enable = false;
+ services.asterisk = {
+ enable = true;
+ confFiles = {
+ "extensions.conf" = ''
+ [from-internal]
+ ; Dial 100 for "hello, world"
+ exten => 100,1,Answer()
+ same => n,Wait(1)
+ same => n,Playback(hello-world)
+ same => n,Hangup()
+
+ exten=>6001,1,Dial(PJSIP/demo-alice,20)
+ exten=>6002,1,Dial(PJSIP/demo-bob,20)
+ '';
+ "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
+
+ ;Definitions for our phones, using the templates above
+
+ [demo-alice](endpoint_internal)
+ auth=demo-alice
+ aors=demo-alice
+ [demo-alice](auth_userpass)
+ password=unsecurepassword ; put a strong, unique password here instead
+ username=demo-alice
+
+ [demo-alice]
+ type=aor
+ contact=sip:192.168.69.113
+ max_contacts=1
+
+ [demo-bob](endpoint_internal)
+ auth=demo-bob
+ aors=demo-bob
+ [demo-bob](auth_userpass)
+ password=unsecurepassword ; put a strong, unique password here instead
+ username=demo-bob
+ [demo-bob](aor_dynamic)
+ '';
+ "logger.conf" = ''
+ [general]
+
+ [logfiles]
+ ; Add debug output to log
+ syslog.local0 => notice,warning,error,debug,verbose4
+ '';
+ };
+ };
+}