diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-05 19:27:42 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-05 19:27:42 +0000 |
commit | 1b3aa4be885923c2fe20ced67566fa662c3afa55 (patch) | |
tree | 66d5eda276da7f3e74e3e261874de6bef7f35b91 /main/rtp.c | |
parent | 304d288b7ec52e9c89f741666a24056f4e6f6534 (diff) |
Add new SIP cli command "sip show channelstats" that displays some QoS data (if we have RTCP reports
and not use the p2p rtp bridge). I could not find a way to detect us using the p2p bridge, which
would be nice.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@128197 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/rtp.c')
-rw-r--r-- | main/rtp.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/main/rtp.c b/main/rtp.c index 146e8c093..4a8bf2b7b 100644 --- a/main/rtp.c +++ b/main/rtp.c @@ -2626,6 +2626,37 @@ void ast_rtp_reset(struct ast_rtp *rtp) rtp->rxseqno = 0; } +/*! Get QoS values from RTP and RTCP data (used in "sip show channelstats") */ +unsigned int ast_rtp_get_qosvalue(struct ast_rtp *rtp, enum ast_rtp_qos_vars value) +{ + if (rtp == NULL) { + if (option_debug > 1) + ast_log(LOG_DEBUG, "NO RTP Structure? Kidding me? \n"); + return 0; + } + if (option_debug > 1 && rtp->rtcp == NULL) { + ast_log(LOG_DEBUG, "NO RTCP structure. Maybe in RTP p2p bridging mode? \n"); + } + + switch (value) { + case AST_RTP_TXCOUNT: + return (unsigned int) rtp->txcount; + case AST_RTP_RXCOUNT: + return (unsigned int) rtp->rxcount; + case AST_RTP_TXJITTER: + return (unsigned int) (rtp->rxjitter * 100.0); + case AST_RTP_RXJITTER: + return (unsigned int) rtp->rtcp ? (rtp->rtcp->reported_jitter / (unsigned int) 65536.0) : 0; + case AST_RTP_RXPLOSS: + return rtp->rtcp ? (rtp->rtcp->expected_prior - rtp->rtcp->received_prior) : 0; + case AST_RTP_TXPLOSS: + return rtp->rtcp ? rtp->rtcp->reported_lost : 0; + case AST_RTP_RTT: + return (unsigned int) rtp->rtcp ? rtp->rtcp->rtt * 100 : 0; + } + return 0; /* To make the compiler happy */ +} + static double __ast_rtp_get_qos(struct ast_rtp *rtp, const char *qos, int *found) { *found = 1; |