Change in osmo-msc[master]: libmsc/gsm_04_11_gsup.c: fix SM-RP-OA encoding for MO SMS over GSUP

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Thu Dec 19 08:36:28 UTC 2019


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/16655 )


Change subject: libmsc/gsm_04_11_gsup.c: fix SM-RP-OA encoding for MO SMS over GSUP
......................................................................

libmsc/gsm_04_11_gsup.c: fix SM-RP-OA encoding for MO SMS over GSUP

We shall not include additional BCD length octet into the value part
of SM-RP-OA (Originating Address) IE. Instead, there should be
ToA/NPI header (1 octet).

Since we do not get ToN/NPI fields from the VLR/HLR, let's assume
the following default values:

  1... .... = Extension: No extension
  .001 .... = Type of number: International (1)
  .... 0001 = Numbering plan: ISDN/telephone (E.164/E.163) (1)

Change-Id: I0f32e2af0ed2d2fea6addf45efbdfee120c2425d
TTCN-3 test case: Ib467eeca6439bc6cce72293fbb5bb48f6d233db9
Related: OS#4324
---
M src/libmsc/gsm_04_11_gsup.c
1 file changed, 13 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/55/16655/1

diff --git a/src/libmsc/gsm_04_11_gsup.c b/src/libmsc/gsm_04_11_gsup.c
index 2abfc92..88c303e 100644
--- a/src/libmsc/gsm_04_11_gsup.c
+++ b/src/libmsc/gsm_04_11_gsup.c
@@ -1,5 +1,5 @@
 /*
- * (C) 2018 by Vadim Yanitskiy <axilirator at gmail.com>
+ * (C) 2018-2019 by Vadim Yanitskiy <axilirator at gmail.com>
  *
  * All Rights Reserved
  *
@@ -53,7 +53,7 @@
 int gsm411_gsup_mo_fwd_sm_req(struct gsm_trans *trans, struct msgb *msg,
 	uint8_t sm_rp_mr, uint8_t *sm_rp_da, uint8_t sm_rp_da_len)
 {
-	uint8_t bcd_buf[GSM48_MI_SIZE] = { 0 };
+	uint8_t bcd_buf[GSM48_MI_SIZE];
 	struct osmo_gsup_message gsup_msg;
 	size_t bcd_len;
 
@@ -65,22 +65,28 @@
 	/* Assign SM-RP-MR to transaction state */
 	trans->sms.sm_rp_mr = sm_rp_mr;
 
-	/* Encode subscriber's MSISDN */
+	/* Encode subscriber's MSISDN as LHV */
 	bcd_len = gsm48_encode_bcd_number(bcd_buf, sizeof(bcd_buf),
-		0, trans->vsub->msisdn);
+					  1, trans->vsub->msisdn);
 	if (bcd_len <= 0 || bcd_len > sizeof(bcd_buf)) {
 		LOG_TRANS(trans, LOGL_ERROR, "Failed to encode subscriber's MSISDN\n");
 		return -EINVAL;
 	}
 
+	/* NOTE: assuming default ToN/NPI values as we don't have this info */
+	bcd_buf[1] = 0x01 /* NPI: ISDN/Telephony Numbering (ITU-T Rec. E.164 / ITU-T Rec. E.163) */
+		   | (0x01 << 4) /* ToN: International Number */
+		   | (0x01 << 7); /* No Extension */
+
 	/* Initialize a new GSUP message */
 	gsup_sm_msg_init(&gsup_msg, OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST,
 		trans->vsub->imsi, &sm_rp_mr);
 
-	/* According to 12.2.3, the MSISDN from VLR is inserted here */
+	/* According to 12.2.3, the MSISDN from VLR is inserted here.
+	 * NOTE: redundant BCD length octet is not included. */
 	gsup_msg.sm_rp_oa_type = OSMO_GSUP_SMS_SM_RP_ODA_MSISDN;
-	gsup_msg.sm_rp_oa_len = bcd_len;
-	gsup_msg.sm_rp_oa = bcd_buf;
+	gsup_msg.sm_rp_oa_len = bcd_len - 1;
+	gsup_msg.sm_rp_oa = bcd_buf + 1;
 
 	/* SM-RP-DA should (already) contain SMSC address */
 	gsup_msg.sm_rp_da_type = OSMO_GSUP_SMS_SM_RP_ODA_SMSC_ADDR;

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I0f32e2af0ed2d2fea6addf45efbdfee120c2425d
Gerrit-Change-Number: 16655
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191219/c2859dde/attachment.htm>


More information about the gerrit-log mailing list