aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Whyte <keith@rhizomatica.org>2023-01-31 20:09:31 +0100
committerKeith Whyte <keith@rhizomatica.org>2023-02-01 03:08:37 +0100
commit404fb1b60ec0b3f3b1864b02ed763396c9c47d54 (patch)
tree1afa533880dd0e32da99f6db5dca99fc1159edc1
parent7d28d2346929a195368cbb62cc474f4dff599bb3 (diff)
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
-rw-r--r--src/libmsc/transaction.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libmsc/transaction.c b/src/libmsc/transaction.c
index 25c0e3c50..6c12409dd 100644
--- a/src/libmsc/transaction.c
+++ b/src/libmsc/transaction.c
@@ -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;