aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-06-17 12:11:51 +0200
committerHarald Welte <laforge@gnumonks.org>2016-06-18 11:34:51 +0000
commitc3fb0dcc8cd01a84942d06267003478b972feadb (patch)
treee3a73e9a9d68dfb59af05661f14a1212393087b3 /src
parent274d29bedd66fb246b614238c9ff36db15f18c5f (diff)
DTX: add support for AMR/HR
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bts-litecell15/tch.c36
-rw-r--r--src/osmo-bts-sysmo/tch.c36
2 files changed, 70 insertions, 2 deletions
diff --git a/src/osmo-bts-litecell15/tch.c b/src/osmo-bts-litecell15/tch.c
index e92c57bc..add79519 100644
--- a/src/osmo-bts-litecell15/tch.c
+++ b/src/osmo-bts-litecell15/tch.c
@@ -431,7 +431,7 @@ int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg)
GsmL1_PhDataInd_t *data_ind = &l1p->u.phDataInd;
uint8_t payload_type = data_ind->msgUnitParam.u8Buffer[0];
uint8_t *payload = data_ind->msgUnitParam.u8Buffer + 1;
- uint8_t payload_len;
+ uint8_t payload_len, sid_first[7] = {0};
struct msgb *rmsg = NULL;
struct gsm_lchan *lchan = &trx->ts[L1SAP_CHAN2TS(chan_nr)].lchan[l1sap_chan2ss(chan_nr)];
@@ -469,6 +469,32 @@ int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg)
frame and drop last SID */
lchan->rtp_tx_marker = true;
break;
+ case GsmL1_TchPlType_Amr_SidFirstP1:
+ if (lchan->type != GSM_LCHAN_TCH_H)
+ goto err_payload_match;
+ LOGP(DL1C, LOGL_DEBUG, "DTX: received SID_FIRST_P1 from L1 "
+ "(%d bytes)\n", payload_len);
+ break;
+ case GsmL1_TchPlType_Amr_SidFirstP2:
+ if (lchan->type != GSM_LCHAN_TCH_H)
+ goto err_payload_match;
+ LOGP(DL1C, LOGL_DEBUG, "DTX: received SID_FIRST_P2 from L1 "
+ "(%d bytes)\n", payload_len);
+ break;
+ case GsmL1_TchPlType_Amr_SidFirstInH:
+ if (lchan->type != GSM_LCHAN_TCH_H)
+ goto err_payload_match;
+ lchan->rtp_tx_marker = true;
+ LOGP(DL1C, LOGL_DEBUG, "DTX: received SID_FIRST_INH from L1 "
+ "(%d bytes)\n", payload_len);
+ break;
+ case GsmL1_TchPlType_Amr_SidUpdateInH:
+ if (lchan->type != GSM_LCHAN_TCH_H)
+ goto err_payload_match;
+ lchan->rtp_tx_marker = true;
+ LOGP(DL1C, LOGL_DEBUG, "DTX: received SID_UPDATE_INH from L1 "
+ "(%d bytes)\n", payload_len);
+ break;
default:
LOGP(DL1C, LOGL_NOTICE, "%s Rx Payload Type %s is unsupported\n",
gsm_lchan_name(lchan),
@@ -490,6 +516,14 @@ int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg)
case GsmL1_TchPlType_Amr:
rmsg = l1_to_rtppayload_amr(payload, payload_len, lchan);
break;
+ case GsmL1_TchPlType_Amr_SidFirstP2:
+ /* L1 do not give us SID_FIRST data, just indication */
+ memcpy(sid_first, payload, payload_len);
+ int len = osmo_amr_rtp_enc(sid_first, 0, AMR_SID, AMR_GOOD);
+ if (len < 0)
+ return 0;
+ rmsg = l1_to_rtppayload_amr(sid_first, len, lchan);
+ break;
}
if (rmsg) {
diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c
index a391fcca..e027408c 100644
--- a/src/osmo-bts-sysmo/tch.c
+++ b/src/osmo-bts-sysmo/tch.c
@@ -523,7 +523,7 @@ int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg)
GsmL1_PhDataInd_t *data_ind = &l1p->u.phDataInd;
uint8_t payload_type = data_ind->msgUnitParam.u8Buffer[0];
uint8_t *payload = data_ind->msgUnitParam.u8Buffer + 1;
- uint8_t payload_len;
+ uint8_t payload_len, sid_first[7] = {0};
struct msgb *rmsg = NULL;
struct gsm_lchan *lchan = &trx->ts[L1SAP_CHAN2TS(chan_nr)].lchan[l1sap_chan2ss(chan_nr)];
@@ -563,6 +563,32 @@ int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg)
frame and drop last SID */
lchan->rtp_tx_marker = true;
break;
+ case GsmL1_TchPlType_Amr_SidFirstP1:
+ if (lchan->type != GSM_LCHAN_TCH_H)
+ goto err_payload_match;
+ LOGP(DL1C, LOGL_DEBUG, "DTX: received SID_FIRST_P1 from L1 "
+ "(%d bytes)\n", payload_len);
+ break;
+ case GsmL1_TchPlType_Amr_SidFirstP2:
+ if (lchan->type != GSM_LCHAN_TCH_H)
+ goto err_payload_match;
+ LOGP(DL1C, LOGL_DEBUG, "DTX: received SID_FIRST_P2 from L1 "
+ "(%d bytes)\n", payload_len);
+ break;
+ case GsmL1_TchPlType_Amr_SidFirstInH:
+ if (lchan->type != GSM_LCHAN_TCH_H)
+ goto err_payload_match;
+ lchan->rtp_tx_marker = true;
+ LOGP(DL1C, LOGL_DEBUG, "DTX: received SID_FIRST_INH from L1 "
+ "(%d bytes)\n", payload_len);
+ break;
+ case GsmL1_TchPlType_Amr_SidUpdateInH:
+ if (lchan->type != GSM_LCHAN_TCH_H)
+ goto err_payload_match;
+ lchan->rtp_tx_marker = true;
+ LOGP(DL1C, LOGL_DEBUG, "DTX: received SID_UPDATE_INH from L1 "
+ "(%d bytes)\n", payload_len);
+ break;
default:
LOGP(DL1C, LOGL_NOTICE, "%s Rx Payload Type %s is unsupported\n",
gsm_lchan_name(lchan),
@@ -586,6 +612,14 @@ int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg)
case GsmL1_TchPlType_Amr:
rmsg = l1_to_rtppayload_amr(payload, payload_len, lchan);
break;
+ case GsmL1_TchPlType_Amr_SidFirstP2:
+ /* L1 do not give us SID_FIRST data, just indication */
+ memcpy(sid_first, payload, payload_len);
+ int len = osmo_amr_rtp_enc(sid_first, 0, AMR_SID, AMR_GOOD);
+ if (len < 0)
+ return 0;
+ rmsg = l1_to_rtppayload_amr(sid_first, len, lchan);
+ break;
}
if (rmsg) {