mgcp: Send the jitter statistics at the end of the call

This commit is contained in:
Holger Hans Peter Freyther
2012-10-24 21:22:47 +02:00
parent 30690adbc8
commit cb306a689e
4 changed files with 13 additions and 4 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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';
}

View File

@@ -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 {