Change in pysim[master]: ts_51_011: fix encoding of EF.MSISDN

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/.

laforge gerrit-no-reply at lists.osmocom.org
Fri Apr 30 16:09:00 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/23997 )

Change subject: ts_51_011: fix encoding of EF.MSISDN
......................................................................

ts_51_011: fix encoding of EF.MSISDN

The json input that is used with EF.MSISDN seems to be somewhat
ambigious. The original code accepts {"msisdn": "+4916012345678"}
only while the output is {"msisdn": [1, 1, "+4916012345678"]}. Lets
add a check and also accept the latter version.

Change-Id: I8f8dd68aac25d3fa3bc1aab06b855f8ec6640258
Related: OS#4963
---
M pySim/ts_51_011.py
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py
index 9123330..15a7907 100644
--- a/pySim/ts_51_011.py
+++ b/pySim/ts_51_011.py
@@ -381,7 +381,11 @@
     def _decode_record_hex(self, raw_hex_data):
         return {'msisdn': dec_msisdn(raw_hex_data)}
     def _encode_record_hex(self, abstract):
-        encoded_msisdn = enc_msisdn(abstract['msisdn'])
+        msisdn = abstract['msisdn']
+        if type(msisdn) == str:
+            encoded_msisdn = enc_msisdn(msisdn)
+        else:
+            encoded_msisdn = enc_msisdn(msisdn[2],msisdn[0],msisdn[1])
         alpha_identifier = (list(self.rec_len)[0] - len(encoded_msisdn) // 2) * "ff"
         return alpha_identifier + encoded_msisdn
 

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I8f8dd68aac25d3fa3bc1aab06b855f8ec6640258
Gerrit-Change-Number: 23997
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210430/f85adc31/attachment.htm>


More information about the gerrit-log mailing list