diff --git a/modules/clan/asterisk/default.nix b/modules/clan/asterisk/default.nix index 6e88508..1f04800 100644 --- a/modules/clan/asterisk/default.nix +++ b/modules/clan/asterisk/default.nix @@ -16,46 +16,52 @@ services.asterisk = { enable = lib.mkDefault true; confFiles = { + # Dial plan config "extensions.conf" = '' - [tests] - ; Dial 100 for "hello, world" + 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() - - [softphones] - include => tests - - [unauthorized] ''; - "sip.conf" = '' - [general] - allowguest=no ; Require authentication - context=unauthorized ; Send unauthorized users to /dev/null - srvlookup=no ; Don't do DNS lookup - udpbindaddr=0.0.0.0 ; Listen on all interfaces - nat=force_rport,comedia ; Assume device is behind NAT - [softphone](!) - type=friend ; Match on username first, IP second - context=softphones ; Send to softphones context in - ; extensions.conf file - host=dynamic ; Device will register with asterisk - disallow=all ; Manually specify codecs to allow - allow=g722 + "pjsip.conf" = '' + [transport-udp] + type=transport + protocol=udp + bind=0.0.0.0,[::] + + [endpoint_internal](!) + type=endpoint + context=from-internal + disallow=all allow=ulaw - allow=alaw - [myphone](softphone) - secret=GhoshevFew ; Change this password! - ''; - "logger.conf" = '' - [general] + [auth_userpass](!) + type=auth + auth_type=userpass - [logfiles] - ; Add debug output to log - syslog.local0 => notice,warning,error,debug + [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) ''; }; };