aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmsc/ran_infra.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2024-02-02 08:34:29 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2024-02-09 05:17:39 +0100
commit17e39a777754c5d2fe18760711c2443a5004ecc5 (patch)
treee63c015d535173e094cf01166b01544c1bf897f7 /src/libmsc/ran_infra.c
parenta2bb6d5c4d4761078aa07796cbb0d9332f0d95ac (diff)
make default RAN codecs configurable in ran_infra
Instead of generating the default codecs list for a RAN for each call, place a pre-composed list in ran_infra.c. (1) The main aim is to allow configuring this list -- subsequent commit Ib5655214ce48c66d095e8f1b7b7106ac3ee43ec0 will add the VTY commands to modify the predefined lists. (2) As a free side effect, this also allows configuring the order of preference for specific codecs. (3) It may also save us some iterations of the codec_map[], which may grow a lot more variants; for example, we could add one entry for each possible AMR mode-set... Change-Id: If46231a53f7512dbd81790fd30462d65fe059aa3
Diffstat (limited to 'src/libmsc/ran_infra.c')
-rw-r--r--src/libmsc/ran_infra.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/libmsc/ran_infra.c b/src/libmsc/ran_infra.c
index 6a178403f..07a1cd2da 100644
--- a/src/libmsc/ran_infra.c
+++ b/src/libmsc/ran_infra.c
@@ -28,6 +28,7 @@
#include <osmocom/msc/ran_msg_a.h>
#include <osmocom/msc/ran_msg_iu.h>
#include <osmocom/msc/ran_peer.h>
+#include <osmocom/msc/codec_mapping.h>
#include <osmocom/msc/ran_infra.h>
@@ -128,3 +129,31 @@ struct ran_infra msc_ran_infra[] = {
};
const int msc_ran_infra_len = ARRAY_SIZE(msc_ran_infra);
+
+static __attribute__((constructor)) void on_dso_load_geran(void)
+{
+ /* Initialize GERAN default codecs, in order of preference. By definition, all codec_mapping entries that match
+ * one of the GERAN GMSK Speech Versions are available. */
+ static const enum gsm48_bcap_speech_ver mobile_codecs[] = {
+ GSM48_BCAP_SV_AMR_F /*!< 4 GSM FR V3 (FR AMR) */,
+ GSM48_BCAP_SV_AMR_H /*!< 5 GSM HR V3 (HR_AMR) */,
+ GSM48_BCAP_SV_EFR /*!< 2 GSM FR V2 (GSM EFR) */,
+ GSM48_BCAP_SV_FR /*!< 0 GSM FR V1 (GSM FR) */,
+ GSM48_BCAP_SV_HR /*!< 1 GSM HR V1 (GSM HR) */,
+ };
+ int i;
+ for (i = 0; i < ARRAY_SIZE(mobile_codecs); i++)
+ sdp_audio_codecs_add_speech_ver(&msc_ran_infra[OSMO_RAT_GERAN_A].codecs, mobile_codecs[i]);
+}
+
+static __attribute__((constructor)) void on_dso_load_utran(void)
+{
+ static const enum gsm48_bcap_speech_ver utran_codecs[] = {
+ GSM48_BCAP_SV_AMR_F /*!< 4 GSM FR V3 (FR AMR) */,
+ GSM48_BCAP_SV_AMR_H /*!< 5 GSM HR V3 (HR_AMR) */,
+ GSM48_BCAP_SV_AMR_FW /*!< 8 GSM FR V5 (FR AMR-WB) */,
+ };
+ int i;
+ for (i = 0; i < ARRAY_SIZE(utran_codecs); i++)
+ sdp_audio_codecs_add_speech_ver(&msc_ran_infra[OSMO_RAT_UTRAN_IU].codecs, utran_codecs[i]);
+}