diff --git a/modules/clan/phonebox/default.nix b/modules/clan/phonebox/default.nix index 455fe44..0eeae7b 100644 --- a/modules/clan/phonebox/default.nix +++ b/modules/clan/phonebox/default.nix @@ -172,72 +172,77 @@ services.asterisk = { enable = lib.mkDefault true; - confFiles = { - "logger.conf" = '' - [general] - dateformat = %F %T.%3q ; ISO 8601 date format with milliseconds - use_callids = yes - appendhostname = no - queue_log = yes - queue_log_to_file = no - queue_log_name = queue_log - queue_log_realtime_use_gmt = no - rotatestrategy = rotate - exec_after_rotate=gzip -9 $\{filename\}.2 - [logfiles] - console => notice,warning,error - security => security - messages => notice,warning,error - full => notice,warning,error,verbose,dtmf,fax - syslog.local0 => notice,warning,error - ''; - # Dial plan config - "extensions.conf" = '' - [from-internal] - exten => 100,1,Answer() - same => n,Playback(hello-world) - same => n,Hangup() + confFiles = + let + machines = lib.attrNames roles.default.machines; + in + { + "logger.conf" = '' + [general] + dateformat = %F %T.%3q ; ISO 8601 date format with milliseconds + use_callids = yes + appendhostname = no + queue_log = yes + queue_log_to_file = no + queue_log_name = queue_log + queue_log_realtime_use_gmt = no + rotatestrategy = rotate + exec_after_rotate=gzip -9 $\{filename\}.2 + [logfiles] + console => notice,warning,error + security => security + messages => notice,warning,error + full => notice,warning,error,verbose,dtmf,fax + syslog.local0 => notice,warning,error + ''; - ''; + # Dial plan config + "extensions.conf" = '' + [from-internal] + exten => 100,1,Answer() + same => n,Playback(hello-world) + same => n,Hangup() - "rtp.conf" = '' - [general] - rtpstart=${rtpPortFrom} - rtpend=${rtpPortTo} - ''; + ''; - "pjsip.conf" = '' - [transport-udp] - type=transport - protocol=udp - bind=0.0.0.0 - [transport-udp6] - type=transport - protocol=udp - bind=:: + "rtp.conf" = '' + [general] + rtpstart=${rtpPortFrom} + rtpend=${rtpPortTo} + ''; - [base_endpoint](!) - type=endpoint - disallow=all - allow=ulaw,alaw,g722,gsm - direct_media=no + "pjsip.conf" = '' + [transport-udp] + type=transport + protocol=udp + bind=0.0.0.0 + [transport-udp6] + type=transport + protocol=udp + bind=:: - [internal_endpoint](!,base_endpoint) - context=from-internal + [base_endpoint](!) + type=endpoint + disallow=all + allow=ulaw,alaw,g722,gsm + direct_media=no - [userpass_auth](!) - type=auth - auth_type=userpass + [internal_endpoint](!,base_endpoint) + context=from-internal - [ip_auth](!) - type=identify - endpoint=external + [userpass_auth](!) + type=auth + auth_type=userpass - [dynamiic_aor](!) - type=aor + [ip_auth](!) + type=identify + endpoint=external - ''; - }; + [dynamiic_aor](!) + type=aor + + ''; + }; }; }; };