diff --git a/modules/clan/phonebox/default.nix b/modules/clan/phonebox/default.nix index 6c8a538..88a9a53 100644 --- a/modules/clan/phonebox/default.nix +++ b/modules/clan/phonebox/default.nix @@ -26,6 +26,7 @@ { lib, config, + pkgs, ... }: let @@ -316,6 +317,27 @@ + serverConf; }; }; + + systemd.services.asterisk-watcher = { + enable = true; + description = "Asterisk Configuration files watcher"; + + requires = [ "asterisk.service" ]; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ inotify-tools asterisk ]; + script = '' + inotifywait -m -e move /etc/asterisk | + while read path action file; do + case "$file" in + pjsip.conf) + echo "restarting pjsip" + asterisk -rx "pjsip reload" + ;; + esac + done + ''; + }; }; }; };