From 5fadec52f2a11353bcf381cd83661d54db50d31a Mon Sep 17 00:00:00 2001 From: paulc Date: Mon, 13 Jul 2020 14:27:52 +0000 Subject: [PATCH] Added setting to execute account operations on reload. git-svn-id: http://voip.null.ro/svn/yate@6414 acf43c95-373e-0410-b603-e72c3f656dc1 --- conf.d/accfile.conf.sample | 4 ++++ modules/server/accfile.cpp | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/conf.d/accfile.conf.sample b/conf.d/accfile.conf.sample index 5811f613..0a6db483 100644 --- a/conf.d/accfile.conf.sample +++ b/conf.d/accfile.conf.sample @@ -84,6 +84,10 @@ ; addr: Local address for H323 listener (leave it empty to listen on all interfaces) ; port: Local port for H323 listener +;[general] +; Only in [general] if auto_oper is not empty on initialize the file is reloaded and each operation executed +;auto_oper=logout,login + [test_sip] enabled=no protocol=sip diff --git a/modules/server/accfile.cpp b/modules/server/accfile.cpp index 15f708f4..ffc85e04 100644 --- a/modules/server/accfile.cpp +++ b/modules/server/accfile.cpp @@ -270,6 +270,21 @@ void AccFilePlugin::initialize() Engine::install(new CmdHandler); Engine::install(new HelpHandler); } + else { + String oper = s_cfg.getValue("general","auto_oper"); + if (oper) { + s_mutex.lock(); + s_cfg.load(); + oper = s_cfg.getValue("general","auto_oper"); + s_mutex.unlock(); + ObjList* list = oper.split(',',false); + for (ObjList* l = list->skipNull(); l; l = l->skipNext()) { + oper = *static_cast (l->get()); + if (oper.trimSpaces()) + emitAccounts(oper); + } + } + } } }; // anonymous namespace