laforge has submitted this change. ( 
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, 12 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/libmsc/gsm_04_11_gsup.c b/src/libmsc/gsm_04_11_gsup.c
index d7edd2f..b6b798f 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 <[email protected]>
+ * (C) 2018-2019 by Vadim Yanitskiy <[email protected]>
  *
  * All Rights Reserved
  *
@@ -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 (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;

--
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: 2
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to