From 23ee5a88cfee4bd58eeb91d2ab610267519f2184 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Tue, 20 Dec 2022 02:16:19 +0100 Subject: playing around with SIP --- abbenay/asterisk.nix | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 abbenay/asterisk.nix 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 + ''; + }; + }; +} -- cgit v1.2.3