Change in pysim[master]: Fixed reading of MSISDN parameter

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
Wed Jan 22 15:48:01 UTC 2020


fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/16947 )

Change subject: Fixed reading of MSISDN parameter
......................................................................


Patch Set 6:

> Patch Set 6:
> 
> > P.S: I have verified the MSISDN programmed on the SIM represented in the same way as it was programmed
> 
> Sorry, i swallowed some of my words :P. I meant, I verified the MSISDN number programmed on the SIM by putting it in a UE and it represented in the same way as it was programmed

Ok, thanks for explanation. I also checked the specs, and here is what I propose:

  # Make sure mandatory fields are present
  if len(res) < 14:
    raise ValueError("EF-MSISDN length is too short")

  # Skip optional Alpha Identifier
  xlen = len(res) - 14
  msisdn_lhv = res[xlen:][:12]

  # Parse the length (in bytes) of BCD encoded number
  # FIXME: it seems the length of ToN/NPI is also included
  bcd_len = int(msisdn_lhv[0])
  if bcd_len > 11: # "This means that the maximum value is 11"
    raise ValueError("EF-MSISDN contains odd BCD length")

  # Parse ToN / NPI
  ton = (int(msisdn_lhv[1]) >> 4) & 0x07
  npi = int(msisdn_lhv[1]) & 0x0f
  bcd_len -= 1

  # Parse MSISDN
  msisdn = swap_nibbles(msisdn_lhv[2:][:bcd_len]).rstrip('f')

I did not test this code though...


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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie914ae83d787e3f1a90f9f305bffd45053b8c863
Gerrit-Change-Number: 16947
Gerrit-PatchSet: 6
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-Assignee: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-CC: dexter <pmaier at sysmocom.de>
Gerrit-Comment-Date: Wed, 22 Jan 2020 15:48:01 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200122/f23dfecb/attachment.htm>


More information about the gerrit-log mailing list