From 16314b9673e40a3d88ca62b496c83a0609b4ad75 Mon Sep 17 00:00:00 2001 From: Mark Nipper Date: Wed, 19 Jun 2024 02:26:39 -0700 Subject: Add new asterisk configuration --- hosts/common/optional/services/asterisk.nix | 165 ++++++++++++++-------------- 1 file changed, 84 insertions(+), 81 deletions(-) (limited to 'hosts/common') diff --git a/hosts/common/optional/services/asterisk.nix b/hosts/common/optional/services/asterisk.nix index 6d80875..0ea66cd 100644 --- a/hosts/common/optional/services/asterisk.nix +++ b/hosts/common/optional/services/asterisk.nix @@ -1,93 +1,96 @@ { config, lib, pkgs, ... }: { services.asterisk = { + confFiles = { + "cdr.conf" = '' + [general] + unanswered = yes + [csv] + usegmtime=yes ; log date/time in GMT. Default is "no" + loguniqueid=yes ; log uniqueid. Default is "no" + loguserfield=yes ; log user field. Default is "no" + accountlogs=yes ; create separate log file for each account code. Default is "yes" + ''; + "console.conf" = '' + [general] + [default] + input_device = default ; When configuring an input device and output device, + output_device = default ; use the name that you see when you run the "console + autoanswer = no + context = default + extension = s + callerid = MyName Here <(256) 428-6000> + language = en + overridecontext = no + mohinterpret = default + active = yes ; This option should only be set for one console. + ''; + "modules.conf" = '' + [modules] + autoload=yes + noload => pbx_gtkconsole.so + noload => pbx_kdeconsole.so + noload => app_intercom.so + noload => chan_modem.so + noload => chan_modem_aopen.so + noload => chan_modem_bestdata.so + noload => chan_modem_i4l.so + noload => chan_capi.so + load => res_musiconhold.so + noload => chan_alsa.so + noload => chan_console.so + noload => chan_oss.so + noload => cdr_sqlite.so + noload => app_directory_odbc.so + noload => res_config_odbc.so + noload => res_config_pgsql.so + ''; + "musiconhold.conf" = '' + [general] + [default] + mode=files + directory=moh + ''; + }; enable = true; - useTheseDefaultConfFiles = []; + useTheseDefaultConfFiles = [ + "indications.conf" + "pjsip_notify.conf" + ]; }; - #sops = { - # secrets = { - # "asterisk/asterisk.conf" = { - # owner = config.users.users.asterisk.name; - # group = config.users.users.asterisk.group; - # mode = "00400"; - # }; - # "asterisk/cdr.conf" = { - # owner = config.users.users.asterisk.name; - # group = config.users.users.asterisk.group; - # mode = "00400"; - # }; - # "asterisk/console.conf" = { - # owner = config.users.users.asterisk.name; - # group = config.users.users.asterisk.group; - # mode = "00400"; - # }; - # "asterisk/extensions.ael" = { - # owner = config.users.users.asterisk.name; - # group = config.users.users.asterisk.group; - # mode = "00400"; - # }; - # "asterisk/indications.conf" = { - # owner = config.users.users.asterisk.name; - # group = config.users.users.asterisk.group; - # mode = "00400"; - # }; - # "asterisk/logger.conf" = { - # owner = config.users.users.asterisk.name; - # group = config.users.users.asterisk.group; - # mode = "00400"; - # }; - # "asterisk/modules.conf" = { - # owner = config.users.users.asterisk.name; - # group = config.users.users.asterisk.group; - # mode = "00400"; - # }; - # "asterisk/musiconhold.conf" = { - # owner = config.users.users.asterisk.name; - # group = config.users.users.asterisk.group; - # mode = "00400"; - # }; - # "asterisk/pjsip.conf" = { - # owner = config.users.users.asterisk.name; - # group = config.users.users.asterisk.group; - # mode = "00400"; - # }; - # "asterisk/pjsip_notify.conf" = { - # owner = config.users.users.asterisk.name; - # group = config.users.users.asterisk.group; - # mode = "00400"; - # }; - # "asterisk/rtp.conf" = { - # owner = config.users.users.asterisk.name; - # group = config.users.users.asterisk.group; - # mode = "00400"; - # }; - # "asterisk/voicemail.conf" = { - # owner = config.users.users.asterisk.name; - # group = config.users.users.asterisk.group; - # mode = "00400"; - # }; - # }; - #}; + sops = { + secrets = { + "asterisk/extensions.ael" = { + owner = config.users.users.asterisk.name; + group = config.users.users.asterisk.group; + mode = "00400"; + path = "/etc/asterisk/extensions.ael"; + }; + "asterisk/pjsip.conf" = { + owner = config.users.users.asterisk.name; + group = config.users.users.asterisk.group; + mode = "00400"; + path = "/etc/asterisk/pjsip.conf"; + }; + "asterisk/rtp.conf" = { + owner = config.users.users.asterisk.name; + group = config.users.users.asterisk.group; + mode = "00400"; + path = "/etc/asterisk/rtp.conf"; + }; + }; + }; systemd.services.asterisk = { #serviceConfig.ExecStart = lib.mkForce "${pkgs.asterisk}/bin/asterisk -U asterisk -C ${config.sops.secrets."asterisk/asterisk.conf".path} -F"; - #unitConfig = { - # ConditionPathExists = [ - # config.sops.secrets."asterisk/asterisk.conf".path - # config.sops.secrets."asterisk/cdr.conf".path - # config.sops.secrets."asterisk/console.conf".path - # config.sops.secrets."asterisk/extensions.ael".path - # config.sops.secrets."asterisk/indications.conf".path - # config.sops.secrets."asterisk/logger.conf".path - # config.sops.secrets."asterisk/modules.conf".path - # config.sops.secrets."asterisk/musiconhold.conf".path - # config.sops.secrets."asterisk/pjsip.conf".path - # config.sops.secrets."asterisk/pjsip_notify.conf".path - # config.sops.secrets."asterisk/rtp.conf".path - # config.sops.secrets."asterisk/voicemail.conf".path - # ]; - #}; + unitConfig = { + ConditionPathExists = [ + config.sops.secrets."asterisk/extensions.ael".path + config.sops.secrets."asterisk/pjsip.conf".path + config.sops.secrets."asterisk/rtp.conf".path + ]; + }; wantedBy = lib.mkForce []; }; } -- cgit v1.2.3