aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMychaela N. Falconia <falcon@freecalypso.org>2023-05-26 13:19:30 +0000
committerlaforge <laforge@osmocom.org>2023-05-27 10:24:09 +0000
commitc18f9f256c905d845c0060f19f3cd46cc40a2fe5 (patch)
tree38c795372f9ed6edc96b2fc79cb1f718090fd719
parent44d47b2cddfdab738ad91a8e94f8eb78cd8e23f9 (diff)
all models, HR1 codec: select RTP output format via vty option
The new vty option "rtp hr-format (rfc5993|ts101318)" selects the RTP output format to be used for HR1 codec, consistently across all models. The default is set to match legacy behavior: ts101318 on osmo-bts-{lc15,oc2g,sysmo} and rfc5993 on osmo-bts-trx. On models where no legacy behavior is applicable, the default is set to rfc5993 as a forward-looking measure - see OS#6036. Closes: OS#5688 Change-Id: I168191874a062429a57904511a1e89e3f588732e
-rw-r--r--include/osmo-bts/bts.h1
-rw-r--r--src/common/bts.c1
-rw-r--r--src/common/l1sap.c24
-rw-r--r--src/common/vty.c15
-rw-r--r--src/osmo-bts-lc15/main.c6
-rw-r--r--src/osmo-bts-oc2g/main.c6
-rw-r--r--src/osmo-bts-sysmo/main.c6
-rw-r--r--src/osmo-bts-trx/main.c6
-rw-r--r--tests/osmo-bts.vty1
9 files changed, 65 insertions, 1 deletions
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 0fff2a5f..7ca32246 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -300,6 +300,7 @@ struct gsm_bts {
int rtp_priority;
bool rtp_nogaps_mode; /* emit RTP stream without any gaps */
+ bool emit_hr_rfc5993;
struct {
uint8_t ciphers; /* flags A5/1==0x1, A5/2==0x2, A5/3==0x4 */
diff --git a/src/common/bts.c b/src/common/bts.c
index 242c5dd2..802cb008 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -330,6 +330,7 @@ int bts_init(struct gsm_bts *bts)
bts->rtp_port_range_next = bts->rtp_port_range_start;
bts->rtp_ip_dscp = -1;
bts->rtp_priority = -1;
+ bts->emit_hr_rfc5993 = true;
/* Default (fall-back) MS/BS Power control parameters */
power_ctrl_params_def_reset(&bts->bs_dpc_params, true);
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index f1692c68..cc775d38 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1561,6 +1561,24 @@ static void send_ul_rtp_packet(struct gsm_lchan *lchan, uint32_t fn,
lchan->rtp_tx_marker = false;
}
+/* a helper function for emitting HR1 UL in RFC 5993 format */
+static void send_rtp_rfc5993(struct gsm_lchan *lchan, uint32_t fn,
+ struct msgb *msg)
+{
+ uint8_t toc;
+
+ OSMO_ASSERT(msg->len == GSM_HR_BYTES);
+ /* FIXME: implement proper SID classification per GSM 06.41 section
+ * 6.1.1; see OS#6036. Until then, detect error-free SID frames
+ * using our existing osmo_hr_check_sid() function. */
+ if (osmo_hr_check_sid(msg->data, msg->len))
+ toc = 0x20;
+ else
+ toc = 0x00;
+ msgb_push_u8(msg, toc);
+ send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
+}
+
/* TCH received from bts model */
static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
struct ph_tch_param *tch_ind)
@@ -1600,7 +1618,11 @@ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
* good enough. */
if (msg->len && tch_ind->lqual_cb >= bts->min_qual_norm) {
/* hand msg to RTP code for transmission */
- send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
+ if (bts->emit_hr_rfc5993 && lchan->type == GSM_LCHAN_TCH_H &&
+ lchan->tch_mode == GSM48_CMODE_SPEECH_V1)
+ send_rtp_rfc5993(lchan, fn, msg);
+ else
+ send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
/* if loopback is enabled, also queue received RTP data */
if (lchan->loopback) {
/* add new frame to queue, make sure the queue doesn't get too long */
diff --git a/src/common/vty.c b/src/common/vty.c
index b17800c9..9f3c6753 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -418,6 +418,8 @@ static void config_write_bts_single(struct vty *vty, const struct gsm_bts *bts)
vty_out(vty, " rtp socket-priority %d%s", bts->rtp_priority, VTY_NEWLINE);
if (bts->rtp_nogaps_mode)
vty_out(vty, " rtp continuous-streaming%s", VTY_NEWLINE);
+ vty_out(vty, " rtp hr-format %s%s",
+ bts->emit_hr_rfc5993 ? "rfc5993" : "ts101318", VTY_NEWLINE);
vty_out(vty, " paging queue-size %u%s", paging_get_queue_max(bts->paging_state),
VTY_NEWLINE);
vty_out(vty, " paging lifetime %u%s", paging_get_lifetime(bts->paging_state),
@@ -797,6 +799,18 @@ DEFUN(cfg_bts_no_rtp_cont_stream,
return CMD_SUCCESS;
}
+DEFUN_ATTR(cfg_bts_rtp_hr_format,
+ cfg_bts_rtp_hr_format_cmd,
+ "rtp hr-format (rfc5993|ts101318)",
+ RTP_STR "HRv1 codec output format\n" "RFC 5993\n" "TS 101 318\n",
+ CMD_ATTR_IMMEDIATE)
+{
+ struct gsm_bts *bts = vty->index;
+
+ bts->emit_hr_rfc5993 = !strcmp(argv[0], "rfc5993");
+ return CMD_SUCCESS;
+}
+
#define PAG_STR "Paging related parameters\n"
DEFUN_ATTR(cfg_bts_paging_queue_size,
@@ -2686,6 +2700,7 @@ int bts_vty_init(void *ctx)
install_element(BTS_NODE, &cfg_bts_rtp_priority_cmd);
install_element(BTS_NODE, &cfg_bts_rtp_cont_stream_cmd);
install_element(BTS_NODE, &cfg_bts_no_rtp_cont_stream_cmd);
+ install_element(BTS_NODE, &cfg_bts_rtp_hr_format_cmd);
install_element(BTS_NODE, &cfg_bts_band_cmd);
install_element(BTS_NODE, &cfg_description_cmd);
install_element(BTS_NODE, &cfg_no_description_cmd);
diff --git a/src/osmo-bts-lc15/main.c b/src/osmo-bts-lc15/main.c
index cb2a9ac8..6c0e73de 100644
--- a/src/osmo-bts-lc15/main.c
+++ b/src/osmo-bts-lc15/main.c
@@ -114,6 +114,12 @@ int bts_model_init(struct gsm_bts *bts)
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP);
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER);
+ /* The default HR codec output format in the absence of saved
+ * vty config needs to match what was implemented previously,
+ * for the sake of existing deployments, i.e., to avoid
+ * a surprise functional change upon software update. */
+ bts->emit_hr_rfc5993 = false;
+
return 0;
}
diff --git a/src/osmo-bts-oc2g/main.c b/src/osmo-bts-oc2g/main.c
index 4484d58b..9918795f 100644
--- a/src/osmo-bts-oc2g/main.c
+++ b/src/osmo-bts-oc2g/main.c
@@ -115,6 +115,12 @@ int bts_model_init(struct gsm_bts *bts)
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP);
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER);
+ /* The default HR codec output format in the absence of saved
+ * vty config needs to match what was implemented previously,
+ * for the sake of existing deployments, i.e., to avoid
+ * a surprise functional change upon software update. */
+ bts->emit_hr_rfc5993 = false;
+
return 0;
}
diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c
index 95492ebc..8dba905c 100644
--- a/src/osmo-bts-sysmo/main.c
+++ b/src/osmo-bts-sysmo/main.c
@@ -82,6 +82,12 @@ int bts_model_init(struct gsm_bts *bts)
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP);
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER);
+ /* The default HR codec output format in the absence of saved
+ * vty config needs to match what was implemented previously,
+ * for the sake of existing deployments, i.e., to avoid
+ * a surprise functional change upon software update. */
+ bts->emit_hr_rfc5993 = false;
+
return 0;
}
diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c
index 4bd7f0f1..f3b85135 100644
--- a/src/osmo-bts-trx/main.c
+++ b/src/osmo-bts-trx/main.c
@@ -158,6 +158,12 @@ int bts_model_init(struct gsm_bts *bts)
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB);
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_INTERF_MEAS);
+ /* The default HR codec output format in the absence of saved
+ * vty config needs to match what was implemented previously,
+ * for the sake of existing deployments, i.e., to avoid
+ * a surprise functional change upon software update. */
+ bts->emit_hr_rfc5993 = true;
+
return 0;
}
diff --git a/tests/osmo-bts.vty b/tests/osmo-bts.vty
index 7f2e78c0..356f2aa4 100644
--- a/tests/osmo-bts.vty
+++ b/tests/osmo-bts.vty
@@ -235,6 +235,7 @@ OsmoBTS(bts)# list
rtp socket-priority <0-255>
rtp continuous-streaming
no rtp continuous-streaming
+ rtp hr-format (rfc5993|ts101318)
band (450|GSM450|480|GSM480|750|GSM750|810|GSM810|850|GSM850|900|GSM900|1800|DCS1800|1900|PCS1900)
description .TEXT
no description