Change in osmo-mgw[master]: add aggregated rtp connection stats to osmo-mgw

2018-11-06 Thread Stefan Sperling
Stefan Sperling has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11519 )

Change subject: add aggregated rtp connection stats to osmo-mgw
..

add aggregated rtp connection stats to osmo-mgw

Add a counter group for aggregated RTP connection statistics.
This group contains RTP counters which aggregate values of the
ephemeral RTP counters maintained per connection (mgcp_conn).

This provides a global overview of RTP processing for each
trunk throughout the lifetime of the osmo-mgw process.

The counters are displayed by 'show mgcp stats' and 'show rate-counters'.

While here, fix a typo in an item of the mgcp_conn_rate_ctr_desc array:
"rtp:octets_rx" was displayed for outbound packes; now says "_tx".

Change-Id: I80d36181600901ae2e0f321dc02b5d54ddc94139
Related: OS#2660
---
M include/osmocom/mgcp/mgcp.h
M include/osmocom/mgcp/mgcp_conn.h
M src/libosmo-mgcp/mgcp_conn.c
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_vty.c
5 files changed, 80 insertions(+), 14 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h
index c8c2cfd..aa5607f 100644
--- a/include/osmocom/mgcp/mgcp.h
+++ b/include/osmocom/mgcp/mgcp.h
@@ -194,9 +194,12 @@
int vty_number_endpoints;
struct mgcp_endpoint *endpoints;

-   /* rate counters */
+   /* Rate counter group which contains stats for processed CRCX commands. 
*/
struct rate_ctr_group *mgcp_crcx_ctr_group;
+   /* Rate counter group which contains stats for processed MDCX commands. 
*/
struct rate_ctr_group *mgcp_mdcx_ctr_group;
+   /* Rate counter group which aggregates stats of individual RTP 
connections. */
+   struct rate_ctr_group *all_rtp_conn_stats;
 };

 enum mgcp_role {
diff --git a/include/osmocom/mgcp/mgcp_conn.h b/include/osmocom/mgcp/mgcp_conn.h
index 3da7334..b0978a6 100644
--- a/include/osmocom/mgcp/mgcp_conn.h
+++ b/include/osmocom/mgcp/mgcp_conn.h
@@ -25,6 +25,7 @@

 #include 
 #include 
+#include 
 #include 

 /* RTP connection related counters */
@@ -35,7 +36,36 @@
 RTP_OCTETS_RX_CTR,
 RTP_PACKETS_TX_CTR,
 RTP_OCTETS_TX_CTR,
-RTP_DROPPED_PACKETS_CTR
+RTP_DROPPED_PACKETS_CTR,
+RTP_NUM_CONNECTIONS,
+};
+
+/* RTP per-connection statistics. Instances of the corresponding rate counter 
group
+ * exist for the lifetime of an RTP connection.
+ * Must be kept in sync with all_rtp_conn_rate_ctr_desc below */
+static const struct rate_ctr_desc mgcp_conn_rate_ctr_desc[] = {
+   [IN_STREAM_ERR_TSTMP_CTR] = {"stream_err_tstmp:in", "Inbound rtp-stream 
timestamp errors."},
+   [OUT_STREAM_ERR_TSTMP_CTR] = {"stream_err_tstmp:out", "Outbound 
rtp-stream timestamp errors."},
+   [RTP_PACKETS_RX_CTR] = {"rtp:packets_rx", "Inbound rtp packets."},
+   [RTP_OCTETS_RX_CTR] = {"rtp:octets_rx", "Inbound rtp octets."},
+   [RTP_PACKETS_TX_CTR] = {"rtp:packets_tx", "Outbound rtp packets."},
+   [RTP_OCTETS_TX_CTR] = {"rtp:octets_tx", "Outbound rtp octets."},
+   [RTP_DROPPED_PACKETS_CTR] = {"rtp:dropped", "dropped rtp packets."}
+};
+
+/* Aggregated RTP connection stats. These are updated when an RTP connection 
is freed.
+ * Must be kept in sync with mgcp_conn_rate_ctr_desc above */
+static const struct rate_ctr_desc all_rtp_conn_rate_ctr_desc[] = {
+   [IN_STREAM_ERR_TSTMP_CTR] = {"all_rtp:err_tstmp_in", "Total inbound 
rtp-stream timestamp errors."},
+   [OUT_STREAM_ERR_TSTMP_CTR] = {"all_rtp:err_tstmp_out", "Total outbound 
rtp-stream timestamp errors."},
+   [RTP_PACKETS_RX_CTR] = {"all_rtp:packets_rx", "Total inbound rtp 
packets."},
+   [RTP_OCTETS_RX_CTR] = {"all_rtp:octets_rx", "Total inbound rtp 
octets."},
+   [RTP_PACKETS_TX_CTR] = {"all_rtp:packets_tx", "Total outbound rtp 
packets."},
+   [RTP_OCTETS_TX_CTR] = {"all_rtp:octets_tx", "Total outbound rtp 
octets."},
+   [RTP_DROPPED_PACKETS_CTR] = {"all_rtp:dropped", "Total dropped rtp 
packets."},
+
+   /* This last counter does not exist in per-connection stats, only here. 
*/
+   [RTP_NUM_CONNECTIONS] = {"all_rtp:num_closed_conns", "Total number of 
rtp connections closed."}
 };

 struct mgcp_conn *mgcp_conn_alloc(void *ctx, struct mgcp_endpoint *endp,
diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index 820c63a..fce8a78 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -31,22 +31,12 @@
 #include 
 #include 

-static const struct rate_ctr_desc rate_ctr_desc[] = {
-   [IN_STREAM_ERR_TSTMP_CTR] = {"stream_err_tstmp:in", "Inbound rtp-stream 
timestamp errors."},
-   [OUT_STREAM_ERR_TSTMP_CTR] = {"stream_err_tstmp:out", "Outbound 
rtp-stream timestamp errors."},
-   [RTP_PACKETS_RX_CTR] = {"rtp:packets_rx", "Inbound rtp packets."},
-   [RTP_OCTETS_RX_CTR] = {"rtp:octets_rx", 

Change in osmo-mgw[master]: add aggregated rtp connection stats to osmo-mgw

2018-11-06 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/11519 )

Change subject: add aggregated rtp connection stats to osmo-mgw
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/11519
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I80d36181600901ae2e0f321dc02b5d54ddc94139
Gerrit-Change-Number: 11519
Gerrit-PatchSet: 3
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Comment-Date: Tue, 06 Nov 2018 10:52:04 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-mgw[master]: add aggregated rtp connection stats to osmo-mgw

2018-11-06 Thread Stefan Sperling
Stefan Sperling has posted comments on this change. ( 
https://gerrit.osmocom.org/11519 )

Change subject: add aggregated rtp connection stats to osmo-mgw
..


Patch Set 3:

(1 comment)

https://gerrit.osmocom.org/#/c/11519/2/include/osmocom/mgcp/mgcp_conn.h
File include/osmocom/mgcp/mgcp_conn.h:

https://gerrit.osmocom.org/#/c/11519/2/include/osmocom/mgcp/mgcp_conn.h@64
PS2, Line 64:   [RTP_OCTETS_TX_CTR] = {"all_rtp:octets_tx", "Total outbound rtp 
octets."},
> You ar still sneaking this octets_rx/octets_tx change without at least 
> describing it in the commit l […]
I am moving this entire array around so I might as well fix the silly typo 
while I'm at it.
But I have now added a paragraph to the log message about it.



--
To view, visit https://gerrit.osmocom.org/11519
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I80d36181600901ae2e0f321dc02b5d54ddc94139
Gerrit-Change-Number: 11519
Gerrit-PatchSet: 3
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Comment-Date: Tue, 06 Nov 2018 10:50:25 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-mgw[master]: add aggregated rtp connection stats to osmo-mgw

2018-11-06 Thread Stefan Sperling
Hello Pau Espin Pedrol, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/11519

to look at the new patch set (#3).

Change subject: add aggregated rtp connection stats to osmo-mgw
..

add aggregated rtp connection stats to osmo-mgw

Add a counter group for aggregated RTP connection statistics.
This group contains RTP counters which aggregate values of the
ephemeral RTP counters maintained per connection (mgcp_conn).

This provides a global overview of RTP processing for each
trunk throughout the lifetime of the osmo-mgw process.

The counters are displayed by 'show mgcp stats' and 'show rate-counters'.

While here, fix a typo in an item of the mgcp_conn_rate_ctr_desc array:
"rtp:octets_rx" was displayed for outbound packes; now says "_tx".

Change-Id: I80d36181600901ae2e0f321dc02b5d54ddc94139
Related: OS#2660
---
M include/osmocom/mgcp/mgcp.h
M include/osmocom/mgcp/mgcp_conn.h
M src/libosmo-mgcp/mgcp_conn.c
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_vty.c
5 files changed, 80 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/19/11519/3
--
To view, visit https://gerrit.osmocom.org/11519
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I80d36181600901ae2e0f321dc02b5d54ddc94139
Gerrit-Change-Number: 11519
Gerrit-PatchSet: 3
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Stefan Sperling 


Change in osmo-mgw[master]: add aggregated rtp connection stats to osmo-mgw

2018-10-31 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/11519 )

Change subject: add aggregated rtp connection stats to osmo-mgw
..


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/11519/2/include/osmocom/mgcp/mgcp_conn.h
File include/osmocom/mgcp/mgcp_conn.h:

https://gerrit.osmocom.org/#/c/11519/2/include/osmocom/mgcp/mgcp_conn.h@64
PS2, Line 64:   [RTP_OCTETS_TX_CTR] = {"all_rtp:octets_tx", "Total outbound rtp 
octets."},
You ar still sneaking this octets_rx/octets_tx change without at least 
describing it in the commit log. Best would be to have it on a separate patch.



--
To view, visit https://gerrit.osmocom.org/11519
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I80d36181600901ae2e0f321dc02b5d54ddc94139
Gerrit-Change-Number: 11519
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Comment-Date: Wed, 31 Oct 2018 12:13:56 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-mgw[master]: add aggregated rtp connection stats to osmo-mgw

2018-10-31 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/11519 )

Change subject: add aggregated rtp connection stats to osmo-mgw
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/11519/1/src/libosmo-mgcp/mgcp_protocol.c
File src/libosmo-mgcp/mgcp_protocol.c:

https://gerrit.osmocom.org/#/c/11519/1/src/libosmo-mgcp/mgcp_protocol.c@108
PS1, Line 108: static const struct rate_ctr_desc all_rtp_conn_rate_ctr_desc[] = 
{
> I think moving both of these definitions to a shared header file is the best 
> approach. […]
Ok, I didn't pay attention to the fact that strings are different, I thought 
only the last RTP_NUM_CONNECTIONS field was added.



--
To view, visit https://gerrit.osmocom.org/11519
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I80d36181600901ae2e0f321dc02b5d54ddc94139
Gerrit-Change-Number: 11519
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Comment-Date: Wed, 31 Oct 2018 12:10:25 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-mgw[master]: add aggregated rtp connection stats to osmo-mgw

2018-10-31 Thread Stefan Sperling
Hello Pau Espin Pedrol, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/11519

to look at the new patch set (#2).

Change subject: add aggregated rtp connection stats to osmo-mgw
..

add aggregated rtp connection stats to osmo-mgw

Add a counter group for aggregated RTP connection statistics.
This group contains RTP counters which aggregate values of the
ephemeral RTP counters maintained per connection (mgcp_conn).

This provides a global overview of RTP processing for each
trunk throughout the lifetime of the osmo-mgw process.

The counters are displayed by 'show mgcp stats' and 'show rate-counters'.

Change-Id: I80d36181600901ae2e0f321dc02b5d54ddc94139
Related: OS#2660
---
M include/osmocom/mgcp/mgcp.h
M include/osmocom/mgcp/mgcp_conn.h
M src/libosmo-mgcp/mgcp_conn.c
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_vty.c
5 files changed, 80 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/19/11519/2
--
To view, visit https://gerrit.osmocom.org/11519
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I80d36181600901ae2e0f321dc02b5d54ddc94139
Gerrit-Change-Number: 11519
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Stefan Sperling 


Change in osmo-mgw[master]: add aggregated rtp connection stats to osmo-mgw

2018-10-31 Thread Stefan Sperling
Stefan Sperling has posted comments on this change. ( 
https://gerrit.osmocom.org/11519 )

Change subject: add aggregated rtp connection stats to osmo-mgw
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/11519/1/src/libosmo-mgcp/mgcp_protocol.c
File src/libosmo-mgcp/mgcp_protocol.c:

https://gerrit.osmocom.org/#/c/11519/1/src/libosmo-mgcp/mgcp_protocol.c@108
PS1, Line 108: static const struct rate_ctr_desc all_rtp_conn_rate_ctr_desc[] = 
{
> Let's better use a macro instead of manually keeping them in sync. That's 
> going to break eventually. […]
I think moving both of these definitions to a shared header file is the best 
approach.
If we keep these two definitions close to each other, the chances of them 
getting out of sync are insignificant.
See patch set 2.

Using a macro seems like overkill to me. Apart from the index values which 
derive from the enum, all the string fields contain different values.
And dynamic allocation of rate counter group definitions is discouraged; the 
rate counter documentation states that definitions are "usually const".



--
To view, visit https://gerrit.osmocom.org/11519
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I80d36181600901ae2e0f321dc02b5d54ddc94139
Gerrit-Change-Number: 11519
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Comment-Date: Wed, 31 Oct 2018 11:43:51 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-mgw[master]: add aggregated rtp connection stats to osmo-mgw

2018-10-30 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/11519 )

Change subject: add aggregated rtp connection stats to osmo-mgw
..


Patch Set 1: Code-Review-1

(5 comments)

https://gerrit.osmocom.org/#/c/11519/1/include/osmocom/mgcp/mgcp.h
File include/osmocom/mgcp/mgcp.h:

https://gerrit.osmocom.org/#/c/11519/1/include/osmocom/mgcp/mgcp.h@197
PS1, Line 197:  /* Rate counter group which contains stats for processed CDCX 
commands. */
CRCX


https://gerrit.osmocom.org/#/c/11519/1/src/libosmo-mgcp/mgcp_conn.c
File src/libosmo-mgcp/mgcp_conn.c:

https://gerrit.osmocom.org/#/c/11519/1/src/libosmo-mgcp/mgcp_conn.c@41
PS1, Line 41:   [RTP_OCTETS_TX_CTR] = {"rtp:octets_tx", "Outbound rtp octets."},
This looks unrelated. Different patch?


https://gerrit.osmocom.org/#/c/11519/1/src/libosmo-mgcp/mgcp_conn.c@248
PS1, Line 248:  OSMO_ASSERT(conn_stats->desc->num_ctr + 1 == 
all_stats->desc->num_ctr);
Can you explain this verification?


https://gerrit.osmocom.org/#/c/11519/1/src/libosmo-mgcp/mgcp_protocol.c
File src/libosmo-mgcp/mgcp_protocol.c:

https://gerrit.osmocom.org/#/c/11519/1/src/libosmo-mgcp/mgcp_protocol.c@108
PS1, Line 108: static const struct rate_ctr_desc all_rtp_conn_rate_ctr_desc[] = 
{
Let's better use a macro instead of manually keeping them in sync. That's going 
to break eventually.

Another possibility: Make an init function which creates this dynamically based 
on the other one and then appends RTP_NUM_CONNECTIONS.


https://gerrit.osmocom.org/#/c/11519/1/src/libosmo-mgcp/mgcp_protocol.c@1659
PS1, Line 1659: alloc_rate_counters(tcfg, tcfg->cfg);
why removing mgcp here and other places?



--
To view, visit https://gerrit.osmocom.org/11519
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I80d36181600901ae2e0f321dc02b5d54ddc94139
Gerrit-Change-Number: 11519
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Tue, 30 Oct 2018 14:38:14 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-mgw[master]: add aggregated rtp connection stats to osmo-mgw

2018-10-30 Thread Stefan Sperling
Stefan Sperling has uploaded this change for review. ( 
https://gerrit.osmocom.org/11519


Change subject: add aggregated rtp connection stats to osmo-mgw
..

add aggregated rtp connection stats to osmo-mgw

Add a counter group for aggregated RTP connection statistics.
This group contains RTP counters which aggregate values of the
ephemeral RTP counters maintained per connection (mgcp_conn).

This provides a global overview of RTP processing for each
trunk throughout the lifetime of the osmo-mgw process.

The counters are displayed by 'show mgcp stats' and 'show rate-counters'.

Change-Id: I80d36181600901ae2e0f321dc02b5d54ddc94139
Related: OS#2660
---
M include/osmocom/mgcp/mgcp.h
M include/osmocom/mgcp/mgcp_conn.h
M src/libosmo-mgcp/mgcp_conn.c
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_vty.c
5 files changed, 65 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/19/11519/1

diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h
index c8c2cfd..4a307cd 100644
--- a/include/osmocom/mgcp/mgcp.h
+++ b/include/osmocom/mgcp/mgcp.h
@@ -194,9 +194,12 @@
int vty_number_endpoints;
struct mgcp_endpoint *endpoints;

-   /* rate counters */
+   /* Rate counter group which contains stats for processed CDCX commands. 
*/
struct rate_ctr_group *mgcp_crcx_ctr_group;
+   /* Rate counter group which contains stats for processed MDCX commands. 
*/
struct rate_ctr_group *mgcp_mdcx_ctr_group;
+   /* Rate counter group which aggregates stats of individual RTP 
connections. */
+   struct rate_ctr_group *all_rtp_conn_stats;
 };

 enum mgcp_role {
diff --git a/include/osmocom/mgcp/mgcp_conn.h b/include/osmocom/mgcp/mgcp_conn.h
index 3da7334..c5c8827 100644
--- a/include/osmocom/mgcp/mgcp_conn.h
+++ b/include/osmocom/mgcp/mgcp_conn.h
@@ -35,7 +35,8 @@
 RTP_OCTETS_RX_CTR,
 RTP_PACKETS_TX_CTR,
 RTP_OCTETS_TX_CTR,
-RTP_DROPPED_PACKETS_CTR
+RTP_DROPPED_PACKETS_CTR,
+RTP_NUM_CONNECTIONS,
 };

 struct mgcp_conn *mgcp_conn_alloc(void *ctx, struct mgcp_endpoint *endp,
diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index 820c63a..e040bc5 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -31,13 +31,14 @@
 #include 
 #include 

+/* Must be kept in sync with all_rtp_conn_rate_ctr_desc in mgcp_protocol.c */
 static const struct rate_ctr_desc rate_ctr_desc[] = {
[IN_STREAM_ERR_TSTMP_CTR] = {"stream_err_tstmp:in", "Inbound rtp-stream 
timestamp errors."},
[OUT_STREAM_ERR_TSTMP_CTR] = {"stream_err_tstmp:out", "Outbound 
rtp-stream timestamp errors."},
[RTP_PACKETS_RX_CTR] = {"rtp:packets_rx", "Inbound rtp packets."},
[RTP_OCTETS_RX_CTR] = {"rtp:octets_rx", "Inbound rtp octets."},
[RTP_PACKETS_TX_CTR] = {"rtp:packets_tx", "Outbound rtp packets."},
-   [RTP_OCTETS_TX_CTR] = {"rtp:octets_rx", "Outbound rtp octets."},
+   [RTP_OCTETS_TX_CTR] = {"rtp:octets_tx", "Outbound rtp octets."},
[RTP_DROPPED_PACKETS_CTR] = {"rtp:dropped", "dropped rtp packets."}
 };

@@ -234,6 +235,23 @@
return NULL;
 }

+static void
+aggregate_rtp_conn_stats(struct mgcp_trunk_config *trunk, struct mgcp_conn_rtp 
*conn_rtp)
+{
+   struct rate_ctr_group *all_stats = trunk->all_rtp_conn_stats;
+   struct rate_ctr_group *conn_stats = conn_rtp->rate_ctr_group;
+   int i;
+
+   if (all_stats == NULL || conn_stats == NULL)
+   return;
+
+   OSMO_ASSERT(conn_stats->desc->num_ctr + 1 == all_stats->desc->num_ctr);
+   for (i = 0; i < conn_stats->desc->num_ctr; i++)
+   rate_ctr_add(_stats->ctr[i], conn_stats->ctr[i].current);
+
+   rate_ctr_inc(_stats->ctr[RTP_NUM_CONNECTIONS]);
+}
+
 /*! free a connection by its ID.
  *  \param[in] endp associated endpoint
  *  \param[in] id identification number of the connection */
@@ -253,6 +271,7 @@

switch (conn->type) {
case MGCP_CONN_TYPE_RTP:
+   aggregate_rtp_conn_stats(endp->tcfg, >u.rtp);
mgcp_rtp_conn_cleanup(>u.rtp);
break;
default:
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 3a0e4ea..767faa9 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 

 struct mgcp_request {
char *name;
@@ -103,6 +104,28 @@
.ctr_desc = mgcp_mdcx_ctr_desc
 };

+/* Must be kept in sync with rate_ctr_desc in mgcp_conn.c */
+static const struct rate_ctr_desc all_rtp_conn_rate_ctr_desc[] = {
+   [IN_STREAM_ERR_TSTMP_CTR] = {"all_rtp:err_tstmp_in", "Total inbound 
rtp-stream timestamp errors."},
+   [OUT_STREAM_ERR_TSTMP_CTR] = {"all_rtp:err_tstmp_out", "Total outbound 
rtp-stream timestamp errors."},
+   [RTP_PACKETS_RX_CTR] =