LCLS: Fix Global Call Reference generation

According to 3gpp spec the Call Reference part of GCR is 5 octets,
3 octets Call ID followed by 2 octets BSS ID.

We are using our internal call reference (4 octets) and the
location area code, or optionally Cell ID as BSS ID
(2 octets). Obviously it does not fit.

Let's use only 3 octets from the call reference, dropping the MSB.

Includes code by Vadim Yanitskiy <vyanitskiy@sysmocom.de>

Change-Id: I9c33a89c819e8925d89ca833d7705ed5ced6b566
This commit is contained in:
Keith Whyte 2023-01-31 20:09:31 +01:00
parent 7d28d23469
commit 404fb1b60e
1 changed files with 10 additions and 4 deletions

View File

@ -153,11 +153,17 @@ struct osmo_lcls *trans_lcls_compose(const struct gsm_trans *trans, bool use_lac
/* net id from Q.1902.3 3-5 bytes, this function gives 3 bytes exactly */
osmo_plmn_to_bcd(lcls->gcr.net, &trans->net->plmn);
osmo_store32be(trans->callref, lcls->gcr.cr);
osmo_store16be(use_lac ? trans->msc_a->via_cell.lai.lac : trans->msc_a->via_cell.cell_identity, lcls->gcr.cr + 3);
LOGP(DCC, LOGL_INFO, "LCLS: allocated %s-based CR-ID %s\n", use_lac ? "LAC" : "CI",
osmo_hexdump(lcls->gcr.cr, 5));
/* TS 29.205 Table B.2.1.9.2 Call Reference ID
* 3 octets Call ID + 2 octets BSS ID
*/
lcls->gcr.cr[2] = (trans->callref >> 0) & 0xff;
lcls->gcr.cr[1] = (trans->callref >> 8) & 0xff;
lcls->gcr.cr[0] = (trans->callref >> 16) & 0xff;
osmo_store16be(use_lac ? trans->msc_a->via_cell.lai.lac : trans->msc_a->via_cell.cell_identity, &lcls->gcr.cr[3]);
LOGP(DCC, LOGL_INFO, "LCLS: allocated %s-based CR-ID %sfor callref 0x%04x\n", use_lac ? "LAC" : "CI",
osmo_hexdump(lcls->gcr.cr, 5), trans->callref);
lcls->config = GSM0808_LCLS_CFG_BOTH_WAY;
lcls->control = GSM0808_LCLS_CSC_CONNECT;