From 122ff88f50109b84a3d8d6428eeae00a7d620d01 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 7 Dec 2017 05:39:52 -0500 Subject: [PATCH] TT#27201 restore reporting of number of running calls Change-Id: I3a439b7b9f473b24e87a67f0b517f4c999c62324 --- debian/patches/series | 1 + debian/patches/sipwise/usage-reporting.patch | 45 ++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 debian/patches/sipwise/usage-reporting.patch diff --git a/debian/patches/series b/debian/patches/series index 0e8c7b89..438c5c14 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -27,3 +27,4 @@ build-fix-excludes.patch build-system-revamp.patch fix-build-with-newer-openssl.patch sipwise/0020-TT-9521-fix-200OK-without-SPD.patch +sipwise/usage-reporting.patch diff --git a/debian/patches/sipwise/usage-reporting.patch b/debian/patches/sipwise/usage-reporting.patch new file mode 100644 index 00000000..a42a2a2e --- /dev/null +++ b/debian/patches/sipwise/usage-reporting.patch @@ -0,0 +1,45 @@ +--- a/core/AmSession.cpp ++++ b/core/AmSession.cpp +@@ -49,6 +49,9 @@ + #include + #include + #include ++#include ++#include ++#include + + volatile unsigned int AmSession::session_num = 0; + AmMutex AmSession::session_num_mut; +@@ -494,6 +497,14 @@ + return id; + } + /* bookkeeping functions - TODO: move to monitoring */ ++static inline void __update_session_count(unsigned int num) { ++ int fd = open("/proc/ngcp/check", O_RDONLY); ++ if (fd >= 0) { ++ // set calls usage ++ ioctl(fd, TCXONC, (int) num); ++ close(fd); ++ } ++} + void AmSession::session_started() { + struct timeval now, delta; + +@@ -511,6 +522,8 @@ + if(session_num > max_session_num) max_session_num = session_num; + + session_num_mut.unlock(); ++ ++ __update_session_count(getSessionNum()); + } + + void AmSession::session_stopped() { +@@ -524,6 +537,8 @@ + //current session number + session_num--; + session_num_mut.unlock(); ++ ++ __update_session_count(getSessionNum()); + } + + unsigned int AmSession::getSessionNum() {