dexter has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30630 )


Change subject: abis_rsl: signal HR GSM RTP format to BTS via RSL
......................................................................

abis_rsl: signal HR GSM RTP format to BTS via RSL

There are two RTP formats that can be used to transfer HR GSM audio (RFC
5339 and ETSI TS 101.318)

Change-Id: I16804364d95da9e1f5ac3b831c31079a7409e58d
Related: OS#5688
---
M include/osmocom/bsc/bts.h
M src/osmo-bsc/abis_rsl.c
M src/osmo-bsc/bts_vty.c
3 files changed, 86 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/30/30630/1

diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index 1a84a0e..ed43138 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -326,6 +326,12 @@
        struct gprs_rlc_cfg rlc_cfg;
 };

+enum hr_gsm_rtp_fmt {
+       RTP_FMT_NATIVE,
+       RTP_FMT_SPEECH_H_V1_TS101318,
+       RTP_FMT_SPEECH_H_V1_RFC5993,
+};
+
 /* One BTS */
 struct gsm_bts {
        /* list header in net->bts_list */
@@ -646,6 +652,9 @@
                TOP_ACCH_CHAN_MODE_SPEECH_V3,   /* Speech channels using AMR 
codec */
        } top_acch_chan_mode;

+       /* Specifies which HR GSM format to use (RFC 5993 or ETSI TS 101.813) */
+       enum hr_gsm_rtp_fmt hr_gsm_rtp_fmt;
+
        /* MS/BS Power Control parameters */
        struct gsm_power_ctrl_params ms_power_ctrl;
        struct gsm_power_ctrl_params bs_power_ctrl;
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index bb1c5d6..864b42d 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -582,6 +582,33 @@
                     (void *)&bts->top_acch_cap);
 }

+/* indicate which RTP format to use for HR GSM, SPEECH V1 */
+static void put_hr_gsm_rtp_fmt_ie(const struct gsm_lchan *lchan,
+                                 const struct rsl_ie_chan_mode *cm,
+                                 struct msgb *msg)
+{
+       struct gsm_bts_trx *trx = lchan->ts->trx;
+       struct gsm_bts *bts = trx->bts;
+       uint8_t val[1];
+
+       /* This setting is only applicable for cassic SPEECH V1 in HR mode */
+       if (cm->chan_rate != RSL_CMOD_SP_GSM1 || lchan->type != GSM_LCHAN_TCH_H)
+               return;
+
+       switch (bts->hr_gsm_rtp_fmt) {
+       case RTP_FMT_SPEECH_H_V1_TS101318:
+               val[0] = 0x00;
+               break;
+       case RTP_FMT_SPEECH_H_V1_RFC5993:
+               val[0] = 0x01;
+               break;
+       default:
+               return;
+       }
+
+       msgb_tlv_put(msg, RSL_IE_OSMO_HR_GSM_RTP_FMT, sizeof(val), val);
+}
+
 /* Write RSL_IE_OSMO_TRAINING_SEQUENCE to msgb. The tsc_set argument's range 
is 1-4, tsc argument range is 0-7. */
 static void put_osmo_training_sequence_ie(struct msgb *msg, uint8_t tsc_set, 
uint8_t tsc)
 {
@@ -716,6 +743,7 @@

        put_rep_acch_cap_ie(lchan, msg);
        put_top_acch_cap_ie(lchan, &cm, msg);
+       put_hr_gsm_rtp_fmt_ie(lchan, &cm, msg);

        /* Selecting a specific TSC Set is only applicable to VAMOS mode */
        if (lchan->activate.info.vamos && lchan->activate.tsc_set >= 1)
@@ -788,6 +816,7 @@

        put_rep_acch_cap_ie(lchan, msg);
        put_top_acch_cap_ie(lchan, &cm, msg);
+       put_hr_gsm_rtp_fmt_ie(lchan, &cm, msg);

        /* Selecting a specific TSC Set is only applicable to VAMOS mode. Send 
this Osmocom specific IE only to OsmoBTS
         * types. */
diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c
index 50e49b8..89665b1 100644
--- a/src/osmo-bsc/bts_vty.c
+++ b/src/osmo-bsc/bts_vty.c
@@ -984,6 +984,45 @@
        return CMD_SUCCESS;
 }

+DEFUN_USRATTR(cfg_bts_hr_gsm_rtp,
+             cfg_bts_hr_gsm_rtp_cmd,
+             X(BSC_VTY_ATTR_NEW_LCHAN),
+             "hr-gsm-rtp (rfc5993|ts101318)",
+             "Set RTP payload format for HR GSM\n"
+             "Payload as specified by RFC 5993 (with TOC header byte)\n"
+             "Payload as specified by TS 101.318 (TIPHON)\n")
+{
+       struct gsm_bts *bts = vty->index;
+
+       if (bts->model->type != GSM_BTS_TYPE_OSMOBTS) {
+               vty_out(vty, "%% HR GSM format selection is not supported by 
BTS %u%s",
+                       bts->nr, VTY_NEWLINE);
+               return CMD_WARNING;
+       }
+
+       if (!strcmp(argv[0], "rfc5993"))
+               bts->hr_gsm_rtp_fmt = RTP_FMT_SPEECH_H_V1_RFC5993;
+       else if (!strcmp(argv[0], "ts101318"))
+               bts->hr_gsm_rtp_fmt = RTP_FMT_SPEECH_H_V1_TS101318;
+       else
+               return CMD_WARNING;
+
+       return CMD_SUCCESS;
+}
+
+DEFUN_USRATTR(cfg_bts_no_hr_gsm_rtp,
+             cfg_bts_no_hr_gsm_rtp_cmd,
+             X(BSC_VTY_ATTR_NEW_LCHAN),
+             "no hr-gsm-rtp",
+             "Disable HR GSM RTP payload format setting)\n")
+{
+       struct gsm_bts *bts = vty->index;
+
+       bts->hr_gsm_rtp_fmt = RTP_FMT_NATIVE;
+
+       return CMD_SUCCESS;
+}
+
 #define CD_STR "Channel Description\n"

 DEFUN_USRATTR(cfg_bts_chan_desc_att,
@@ -4660,6 +4699,13 @@
            || bts->rep_acch_cap.dl_facch_cmd)
                vty_out(vty, "  repeat rxqual %u%s", bts->rep_acch_cap.rxqual, 
VTY_NEWLINE);

+       if (bts->hr_gsm_rtp_fmt != RTP_FMT_NATIVE) {
+               if (bts->hr_gsm_rtp_fmt == RTP_FMT_SPEECH_H_V1_RFC5993)
+                       vty_out(vty, "  hr-gsm-rtp rfc5993%s", VTY_NEWLINE);
+               if (bts->hr_gsm_rtp_fmt == RTP_FMT_SPEECH_H_V1_TS101318)
+                       vty_out(vty, "  hr-gsm-rtp ts101318%s", VTY_NEWLINE);
+       }
+
        if (bts->interf_meas_params_cfg.avg_period != 
interf_meas_params_def.avg_period) {
                vty_out(vty, "  interference-meas avg-period %u%s",
                        bts->interf_meas_params_cfg.avg_period,
@@ -4876,6 +4922,8 @@
        install_element(BTS_NODE, &cfg_bts_top_no_dl_acch_cmd);
        install_element(BTS_NODE, &cfg_bts_top_dl_acch_rxqual_cmd);
        install_element(BTS_NODE, &cfg_bts_top_dl_acch_chan_mode_cmd);
+       install_element(BTS_NODE, &cfg_bts_hr_gsm_rtp_cmd);
+       install_element(BTS_NODE, &cfg_bts_no_hr_gsm_rtp_cmd);
        install_element(BTS_NODE, &cfg_bts_interf_meas_avg_period_cmd);
        install_element(BTS_NODE, &cfg_bts_interf_meas_level_bounds_cmd);
        install_element(BTS_NODE, &cfg_bts_srvcc_fast_return_cmd);

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30630
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I16804364d95da9e1f5ac3b831c31079a7409e58d
Gerrit-Change-Number: 30630
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <[email protected]>
Gerrit-MessageType: newchange

Reply via email to