From c17697d337f657ca18225f8462a76e8a683a4cfb Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 28 Mar 2023 02:27:16 +0200 Subject: [PATCH] common/vty: Print AMR MultiRate Configuration in "show lchan" It can be useful to introspect the current active AMR mode set. Related: OS#5944 Change-Id: I630af8c3835c2fcbea325c07db269d25e4e18f62 --- src/common/vty.c | 14 ++++++++++++++ src/osmo-bts-virtual/Makefile.am | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/common/vty.c b/src/common/vty.c index bd182214b..93fc0d628 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -1941,6 +1942,19 @@ static void lchan_dump_full_vty(struct vty *vty, const struct gsm_lchan *lchan) vty_out(vty, " Channel Mode / Codec: %s%s", gsm48_chan_mode_name(lchan->tch_mode), VTY_NEWLINE); + if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) { + const struct amr_multirate_conf *amr_mrc = &lchan->tch.amr_mr; + const struct gsm48_multi_rate_conf *mr_conf = + (const struct gsm48_multi_rate_conf *) amr_mrc->gsm48_ie; + vty_out(vty, " AMR Multi-Rate Configuration: ICMI=%u, Start Mode=%u gsm48=%02x%02x%s", + mr_conf->icmi, mr_conf->smod, amr_mrc->gsm48_ie[0], amr_mrc->gsm48_ie[1], VTY_NEWLINE); + for (uint8_t i = 0; i < amr_mrc->num_modes; i++) { + const struct amr_mode *amode = &amr_mrc->mode[i]; + vty_out(vty, " AMR Mode %u (%s), threshold=%u, hysteresis=%u%s", + amode->mode, osmo_amr_type_name(amode->mode), + amode->threshold, amode->hysteresis, VTY_NEWLINE); + } + } if (lchan->abis_ip.bound_ip) { ia.s_addr = htonl(lchan->abis_ip.bound_ip); diff --git a/src/osmo-bts-virtual/Makefile.am b/src/osmo-bts-virtual/Makefile.am index 2ae53b4a9..bbb79ecab 100644 --- a/src/osmo-bts-virtual/Makefile.am +++ b/src/osmo-bts-virtual/Makefile.am @@ -7,6 +7,7 @@ AM_CFLAGS = \ $(LIBOSMOABIS_CFLAGS) \ $(LIBOSMOTRAU_CFLAGS) \ $(LIBOSMONETIF_CFLAGS) \ + $(LIBOSMOCODEC_CFLAGS) \ $(LIBGPS_CFLAGS) \ $(NULL) @@ -20,6 +21,7 @@ COMMON_LDADD = \ $(LIBOSMOABIS_LIBS) \ $(LIBOSMOTRAU_LIBS) \ $(LIBOSMONETIF_LIBS) \ + $(LIBOSMOCODEC_LIBS) \ -ldl \ $(NULL)