aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-10-24 21:22:47 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-11-12 10:45:09 +0100
commitcb306a689e4bef5d2f82315ff4c694517750519f (patch)
tree28fe81ac75a26689f7edbc346bc2eab6c6030d08
parent30690adbc81a1fe15eb5e48b3201772486d79ed0 (diff)
mgcp: Send the jitter statistics at the end of the call
-rw-r--r--openbsc/include/openbsc/mgcp_internal.h1
-rw-r--r--openbsc/src/libmgcp/mgcp_network.c7
-rw-r--r--openbsc/src/libmgcp/mgcp_protocol.c7
-rw-r--r--openbsc/tests/mgcp/mgcp_test.c2
4 files changed, 13 insertions, 4 deletions
diff --git a/openbsc/include/openbsc/mgcp_internal.h b/openbsc/include/openbsc/mgcp_internal.h
index 759745a07..025b813a5 100644
--- a/openbsc/include/openbsc/mgcp_internal.h
+++ b/openbsc/include/openbsc/mgcp_internal.h
@@ -155,6 +155,7 @@ struct mgcp_trunk_config *mgcp_trunk_num(struct mgcp_config *cfg, int index);
void mgcp_state_calc_loss(struct mgcp_rtp_state *s, struct mgcp_rtp_end *,
uint32_t *expected, int *loss);
+uint32_t mgcp_state_calc_jitter(struct mgcp_rtp_state *);
#endif
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index b28c5a15d..03d0f35f6 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -677,3 +677,10 @@ void mgcp_state_calc_loss(struct mgcp_rtp_state *state,
*loss = INT_MAX;
}
}
+
+uint32_t mgcp_state_calc_jitter(struct mgcp_rtp_state *state)
+{
+ if (!state->initialized)
+ return 0;
+ return state->jitter >> 4;
+}
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index 0d8e9ea55..4b0222ffb 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -1121,14 +1121,15 @@ int mgcp_reset_transcoder(struct mgcp_config *cfg)
void mgcp_format_stats(struct mgcp_endpoint *endp, char *msg, size_t size)
{
- uint32_t expected;
+ uint32_t expected, jitter;
int ploss;
mgcp_state_calc_loss(&endp->net_state, &endp->net_end,
&expected, &ploss);
+ jitter = mgcp_state_calc_jitter(&endp->net_state);
- snprintf(msg, size, "\r\nP: PS=%u, OS=%u, PR=%u, OR=%u, PL=%d",
+ snprintf(msg, size, "\r\nP: PS=%u, OS=%u, PR=%u, OR=%u, PL=%d, JI=%d",
endp->bts_end.packets, endp->bts_end.octets,
endp->net_end.packets, endp->net_end.octets,
- ploss);
+ ploss, jitter);
msg[size - 1] = '\0';
}
diff --git a/openbsc/tests/mgcp/mgcp_test.c b/openbsc/tests/mgcp/mgcp_test.c
index 02bcddb2e..9b65666f4 100644
--- a/openbsc/tests/mgcp/mgcp_test.c
+++ b/openbsc/tests/mgcp/mgcp_test.c
@@ -72,7 +72,7 @@
"C: 2\r\n"
#define DLCX_RET "250 7 OK\r\n" \
- "P: PS=0, OS=0, PR=0, OR=0, PL=0\r\n"
+ "P: PS=0, OS=0, PR=0, OR=0, PL=0, JI=0\r\n"
struct mgcp_test {