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
Tue Jan 21 22:57:10 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: Code-Review-1

(2 comments)

https://gerrit.osmocom.org/c/pysim/+/16947/6/pySim-read.py 
File pySim-read.py:

https://gerrit.osmocom.org/c/pysim/+/16947/6/pySim-read.py@216 
PS6, Line 216: 			dial_num = res[(x_bytes * 2) + 4:(x_bytes * 2) + 24]
I am sorry, but this code is hard to read.

AFAIU, the format here is LHV:

OCT0  Length of BCD encoded number (excluding ToN/NPI byte)
OCT1  X... .... = Extension bit
OCT1  .XXX .... = ToN (Type of Number)
OCT1  .... XXXX = NPI (Numbering Plan Identification)
OCT2...  Called Party BCD Number: 1230000091

so the code can be:

  bcd_len = int(res[0])
  bcd_ton = (int(res[1]) >> 4) & 0x07
  bcd_npi = int(res[1]) & 0x0f
  # TODO: extension bit indicates presence of an additional header
  # TODO: we may want to check the length: assert(bcd_len == len(res[2:]))
  msisdn_res = swap_nibbles(res[2:]).rstrip('f')

Correct me if I am wrong.


https://gerrit.osmocom.org/c/pysim/+/16947/6/pySim-read.py@220 
PS6, Line 220: print
Makes sense to print ToN / NPI here too.



-- 
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: laforge <laforge at osmocom.org>
Gerrit-CC: dexter <pmaier at sysmocom.de>
Gerrit-Comment-Date: Tue, 21 Jan 2020 22:57:10 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200121/07334983/attachment.htm>


More information about the gerrit-log mailing list