aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-12-19 17:22:22 +0900
committerVadim Yanitskiy <axilirator@gmail.com>2019-12-19 22:12:18 +0900
commit6e7228245465d626b0e77577daf6247da168b826 (patch)
tree78758655b159d47853dab3fe837ccbabdf2aca70
parent61f4780f29d0e799966ca010fb80faadee8656a7 (diff)
libmsc/gsm_04_11_gsup.c: fix SM-RP-OA encoding for MO SMS over GSUPfixeria/sms
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
-rw-r--r--src/libmsc/gsm_04_11_gsup.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/libmsc/gsm_04_11_gsup.c b/src/libmsc/gsm_04_11_gsup.c
index d7edd2f98..b6b798f87 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@gmail.com>
+ * (C) 2018-2019 by Vadim Yanitskiy <axilirator@gmail.com>
*
* All Rights Reserved
*
@@ -65,22 +65,28 @@ int gsm411_gsup_mo_fwd_sm_req(struct gsm_trans *trans, struct msgb *msg,
/* 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 (with room for ToN/NPI header) */
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;