Added USER_END trigger

This commit is contained in:
Thulinma 2018-05-15 16:54:20 +02:00
parent 46615efe49
commit 93f8b01a0b
4 changed files with 23 additions and 10 deletions

View file

@ -153,6 +153,12 @@ namespace Controller {
trgs["USER_NEW"]["response"] = "always";
trgs["USER_NEW"]["response_action"] = "If false, denies the session while it remains in the cache. If true, accepts the session while it remains in the cache.";
trgs["USER_END"]["when"] = "Every time a session ends (same time it is written to the access log)";
trgs["USER_END"]["stream_specific"] = true;
trgs["USER_END"]["payload"] = "session identifier (hexadecimal string)\nstream name (string)\nconnector (string)\nconnection address (string)\nduration in seconds (integer)\nuploaded bytes total (integer)\ndownloaded bytes total (integer)\ntags (string)";
trgs["USER_END"]["response"] = "ignored";
trgs["USER_END"]["response_action"] = "None.";
trgs["LIVE_BANDWIDTH"]["when"] = "Every time a new live stream key frame is received";
trgs["LIVE_BANDWIDTH"]["stream_specific"] = true;
trgs["LIVE_BANDWIDTH"]["payload"] = "stream name (string)\ncurrent bytes per second (integer)";

View file

@ -92,6 +92,12 @@ namespace Controller{
rlxAccs->setString("tags", tags, newEndPos);
rlxAccs->setEndPos(newEndPos + 1);
}
if (Triggers::shouldTrigger("USER_END", strm)){
std::stringstream plgen;
plgen << sessId << "\n" << strm << "\n" << conn << "\n" << host << "\n" << duration << "\n" << up << "\n" << down << "\n" << tags;
std::string payload = plgen.str();
Triggers::doTrigger("USER_END", payload, strm);
}
}
///\brief Write contents to Filename