DSM: new monitor_select_filters, from P-App-Param

when searching call records from monitoring for new calls,
AVP names set in monitor_select_filters may be used to filter
call records, additionally to caller/callee filters
sayer/1.4-spce2.6
Stefan Sayer 16 years ago
parent 4aadd94766
commit 2e6cdd78d4

@ -72,6 +72,7 @@ bool DSMFactory::MonitoringFullTransitions;
MonSelectType DSMFactory::MonSelectCaller;
MonSelectType DSMFactory::MonSelectCallee;
vector<string> DSMFactory::MonSelectFilters;
string DSMFactory::MonSelectFallback;
@ -211,6 +212,20 @@ int DSMFactory::onLoad()
cfg_usecallee.c_str());
}
MonSelectFilters = explode(cfg.getParameter("monitor_select_filters"), ",");
string filters;
for (vector<string>::iterator it =
MonSelectFilters.begin(); it != MonSelectFilters.end(); it++) {
if (it != MonSelectFilters.begin())
filters += ", ";
filters+=*it;
}
if (MonSelectFilters.size()) {
DBG("using additional monitor app select filters: %s\n",
filters.c_str());
} else {
DBG("not using additional monitor app select filters\n");
}
MonSelectFallback = cfg.getParameter("monitor_select_fallback");
#endif
@ -515,7 +530,8 @@ void AmArg2DSMStrMap(const AmArg& arg,
}
}
void DSMFactory::runMonitorAppSelect(const AmSipRequest& req, string& start_diag, map<string, string>& vars) {
void DSMFactory::runMonitorAppSelect(const AmSipRequest& req, string& start_diag,
map<string, string>& vars) {
#define FALLBACK_OR_EXCEPTION(code, reason) \
if (MonSelectFallback.empty()) { \
throw AmSession::Exception(code, reason); \
@ -579,8 +595,22 @@ void DSMFactory::runMonitorAppSelect(const AmSipRequest& req, string& start_diag
}
DBG(" && looking for callee=='%s'\n", req.user.c_str());
di_args.push(callee_filter);
di_args.push(callee_filter);
}
// apply additional filters
if (MonSelectFilters.size()) {
string app_params = getHeader(req.hdrs, PARAM_HDR);
for (vector<string>::iterator it =
MonSelectFilters.begin(); it != MonSelectFilters.end(); it++) {
AmArg filter;
filter.push(*it); // avp name
string app_param_val = get_header_keyvalue(app_params, *it);
filter.push(app_param_val);
di_args.push(filter);
DBG(" && looking for %s=='%s'\n", it->c_str(), app_param_val.c_str());
}
}
MONITORING_GLOBAL_INTERFACE->invoke("listByFilter",di_args,ret);
if ((ret.getType()!=AmArg::Array)||

@ -83,6 +83,7 @@ class DSMFactory
static MonSelectType MonSelectCaller;
static MonSelectType MonSelectCallee;
static string MonSelectFallback;
static vector<string> MonSelectFilters;
#endif // USE_MONITORING

@ -103,6 +103,21 @@ load_prompts=/usr/local/etc/sems/dsm_in_prompts.conf,/usr/local/etc/sems/dsm_out
#
#monitor_select_use_callee=no
# monitor_select_filters=<comma-separated list of filter variables>
#
# for mon_select, records are also filtered by these variables,
# the values taked of P-App-Params.
#
# e.g. if
# P-App-Param: product_id=2;appdomain=iptel.org
# and
# monitor_select_filters=product_id,appdomain
# the record in monitoring must have also those avps set:
# appdomain=iptel.org
# product_id=2
#
# monitor_select_filters=product_id,appdomain
# monitor_select_fallback=app
#
# fallback application for $(mon_select) application selection

Loading…
Cancel
Save