aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-09-21 11:18:06 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-09-21 14:34:07 +0200
commit668f8df3be7f644056d16ea4a7fd7929429da0b4 (patch)
tree4340aac14634439f06a27f09f5467a3a7fc7d5ab
parentcc4a08bdc753492c4367e4786a573a6cdf84b56e (diff)
audio/rsl: Include statistics for one call
Use the new libosmo-abis API to query the session for the statistics and then send it as a TLV element to the BSC. This can be used to do post processing about the call. E.g to figure out if no audio arrived at all.
-rw-r--r--src/common/rsl.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c
index f31b2e35..9f1cf29b 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -1191,6 +1191,37 @@ static int rsl_rx_sacch_inf_mod(struct msgb *msg)
/*
* ip.access related messages
*/
+static void rsl_add_rtp_stats(struct gsm_lchan *lchan, struct msgb *msg)
+{
+ struct ipa_stats {
+ uint32_t packets_sent;
+ uint32_t octets_sent;
+ uint32_t packets_recv;
+ uint32_t octets_recv;
+ uint32_t packets_lost;
+ uint32_t arrival_jitter;
+ uint32_t avg_tx_delay;
+ } __attribute__((packed));
+
+ struct ipa_stats stats;
+
+
+ memset(&stats, 0, sizeof(stats));
+
+
+ osmo_rtp_socket_stats(lchan->abis_ip.rtp_socket,
+ &stats.packets_sent, &stats.octets_sent,
+ &stats.packets_recv, &stats.octets_recv,
+ &stats.packets_lost, &stats.arrival_jitter);
+ /* convert to network byte order */
+ stats.packets_sent = htonl(stats.packets_sent);
+ stats.octets_sent = htonl(stats.octets_sent);
+ stats.packets_recv = htonl(stats.packets_recv);
+ stats.octets_recv = htonl(stats.octets_recv);
+ stats.packets_lost = htonl(stats.packets_lost);
+
+ msgb_tlv_put(msg, RSL_IE_IPAC_CONN_STAT, sizeof(stats), (uint8_t *) &stats);
+}
int rsl_tx_ipac_dlcx_ind(struct gsm_lchan *lchan, uint8_t cause)
{
@@ -1204,6 +1235,7 @@ int rsl_tx_ipac_dlcx_ind(struct gsm_lchan *lchan, uint8_t cause)
return -ENOMEM;
msgb_tv16_put(nmsg, RSL_IE_IPAC_CONN_ID, htons(lchan->abis_ip.conn_id));
+ rsl_add_rtp_stats(lchan, nmsg);
msgb_tlv_put(nmsg, RSL_IE_CAUSE, 1, &cause);
rsl_ipa_push_hdr(nmsg, RSL_MT_IPAC_DLCX_IND, gsm_lchan2chan_nr(lchan));
@@ -1275,8 +1307,10 @@ static int rsl_tx_ipac_dlcx_ack(struct gsm_lchan *lchan, int inc_conn_id)
if (!msg)
return -ENOMEM;
- if (inc_conn_id)
+ if (inc_conn_id) {
msgb_tv_put(msg, RSL_IE_IPAC_CONN_ID, lchan->abis_ip.conn_id);
+ rsl_add_rtp_stats(lchan, msg);
+ }
rsl_ipa_push_hdr(msg, RSL_MT_IPAC_DLCX_ACK, chan_nr);
msg->trx = lchan->ts->trx;
@@ -1555,11 +1589,11 @@ static int rsl_rx_ipac_dlcx(struct msgb *msg)
if (TLVP_PRESENT(&tp, RSL_IE_IPAC_CONN_ID))
inc_conn_id = 1;
+ rc = rsl_tx_ipac_dlcx_ack(lchan, inc_conn_id);
osmo_rtp_socket_free(lchan->abis_ip.rtp_socket);
lchan->abis_ip.rtp_socket = NULL;
msgb_queue_flush(&lchan->dl_tch_queue);
-
- return rsl_tx_ipac_dlcx_ack(lchan, inc_conn_id);
+ return rc;
}
/*