Change in pysim[master]: pySim-read.py: Enabled reading P-CSCF address from ISIM

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

herlesupreeth gerrit-no-reply at lists.osmocom.org
Wed Dec 23 09:15:02 UTC 2020


herlesupreeth has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/21856 )


Change subject: pySim-read.py: Enabled reading P-CSCF address from ISIM
......................................................................

pySim-read.py: Enabled reading P-CSCF address from ISIM

As per 3GPP TS 31.103 version 14.2.0 Release 14, this EF can found under ADF.ISIM at File Id 6f09.

This EF contains one or more Proxy Call Session Control Function addresses.
The first record in the EF shall be considered to be of the highest priority
If ISIM service n°1 and/or service n°5 is available, this file shall be present.

Change-Id: I7a701212c84d3dc5d4c8ccbcf638c97ceda33654
---
M pySim-read.py
M pySim/cards.py
M pysim-testdata/sysmoISIM-SJA2.ok
3 files changed, 34 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/56/21856/1

diff --git a/pySim-read.py b/pySim-read.py
index c8b1a5d..b6eeab7 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -30,7 +30,7 @@
 import sys
 from pySim.ts_51_011 import EF, DF, EF_SST_map, EF_AD_mode_map
 from pySim.ts_31_102 import EF_UST_map, EF_USIM_ADF_map
-from pySim.ts_31_103 import EF_IST_map
+from pySim.ts_31_103 import EF_IST_map, EF_ISIM_ADF_map
 
 from pySim.commands import SimCardCommands
 from pySim.cards import card_detect, Card
@@ -294,6 +294,16 @@
 		except Exception as e:
 			print("ePDGSelection: Can't read file -- " + str(e))
 
+	# Select ISIM application by its AID
+	if '9000' == card.select_adf_by_aid(adf="isim"):
+		#EF.P-CSCF - P-CSCF Address
+		try:
+			if card.file_exists(EF_ISIM_ADF_map['PCSCF']):
+				res = card.read_pcscf()
+				print("P-CSCF:\n%s" % (len(res) and res or '\tNot available\n',))
+		except Exception as e:
+			print("P-CSCF: Can't read file -- " + str(e))
+
 	# Check whether we have th AID of ISIM, if so select it by its AID
 	# EF.IST - File Id in ADF ISIM : 6f07
 	if '9000' == card.select_adf_by_aid(adf="isim"):
diff --git a/pySim/cards.py b/pySim/cards.py
index 81b2f5d..bc67ecd 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -25,6 +25,7 @@
 
 from pySim.ts_51_011 import EF, DF
 from pySim.ts_31_102 import EF_USIM_ADF_map
+from pySim.ts_31_103 import EF_ISIM_ADF_map
 from pySim.utils import *
 from smartcard.util import toBytes
 
@@ -309,6 +310,18 @@
 	def __init__(self, ssc):
 		super(IsimCard, self).__init__(ssc)
 
+	def read_pcscf(self):
+		rec_cnt = self._scc.record_count(EF_ISIM_ADF_map['PCSCF'])
+		pcscf_recs = ""
+		for i in range(0, rec_cnt):
+			(res, sw) = self._scc.read_record(EF_ISIM_ADF_map['PCSCF'], i + 1)
+			if sw == '9000':
+				content = dec_addr_tlv(res)
+				pcscf_recs += "%s" % (len(content) and content or '\tNot available\n')
+			else:
+				pcscf_recs += "\tP-CSCF: Can't read, response code = %s\n" % (sw)
+		return pcscf_recs
+
 
 class _MagicSimBase(Card):
 	"""
diff --git a/pysim-testdata/sysmoISIM-SJA2.ok b/pysim-testdata/sysmoISIM-SJA2.ok
index 6487958..88872df 100644
--- a/pysim-testdata/sysmoISIM-SJA2.ok
+++ b/pysim-testdata/sysmoISIM-SJA2.ok
@@ -173,6 +173,16 @@
 	ffffffffffff # unused
 	ffffffffffff # unused
 
+P-CSCF:
+	Not available
+	Not available
+	Not available
+	Not available
+	Not available
+	Not available
+	Not available
+	Not available
+
 ISIM Service Table: 190200
 	Service 1 - P-CSCF address
 	Service 4 - GBA-based Local Key Establishment Mechanism

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I7a701212c84d3dc5d4c8ccbcf638c97ceda33654
Gerrit-Change-Number: 21856
Gerrit-PatchSet: 1
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201223/bfe73e5f/attachment.htm>


More information about the gerrit-log mailing list