aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSupreeth Herle <herlesupreeth@gmail.com>2020-03-24 17:32:21 +0100
committerherlesupreeth <herlesupreeth@gmail.com>2021-01-05 10:44:12 +0100
commitcf727f27335f42c066af02d3a0ac37b62971ed9f (patch)
tree3c9decf692a569d7c86442e0b796933bf45cb6d9
parent5ad9aec98f35918ae06ff048422c2bc83c7b6b3a (diff)
sysmoISIM-SJA2: Add support for programming Proxy Call Session Control Function address
Example: ./pySim-prog.py -p 0 -x 001 -y 01 -s 8988211900000000004 -i 001011234567895 -k 8baf473f2f8fd09487cccbd7097c6862 --op 11111111111111111111111111111111 -o 8E27B6AF0E692E750F32667A3B14605D -a 85524953 -n isim.test --msisdn 0598765432100 --epdgid epdg.epc.mnc001.mcc001.pub.3gppnetwork.org --pcscf pcscf.testims.org Change-Id: Ic654baa93e2ecb91ced596b49dde4c1f208ecda2
-rwxr-xr-xpySim-prog.py4
-rw-r--r--pySim/cards.py20
2 files changed, 24 insertions, 0 deletions
diff --git a/pySim-prog.py b/pySim-prog.py
index 93ae924..7ad57e6 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -153,6 +153,9 @@ def parse_options():
parser.add_option("--epdgSelection", dest="epdgSelection",
help="Set PLMN for ePDG Selection Information. (Only Operator Identifier FQDN format supported)",
)
+ parser.add_option("--pcscf", dest="pcscf",
+ help="Set Proxy Call Session Control Function (P-CSCF) Address. (Only FQDN format supported)",
+ )
parser.add_option("--read-imsi", dest="read_imsi", action="store_true",
help="Read the IMSI from the CARD", default=False
)
@@ -460,6 +463,7 @@ def gen_parameters(opts):
'msisdn' : opts.msisdn,
'epdgid' : opts.epdgid,
'epdgSelection' : opts.epdgSelection,
+ 'pcscf' : opts.pcscf,
}
diff --git a/pySim/cards.py b/pySim/cards.py
index b9bd699..0b2d2a6 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -326,6 +326,16 @@ class IsimCard(Card):
pcscf_recs += "\tP-CSCF: Can't read, response code = %s\n" % (sw)
return pcscf_recs
+ def update_pcscf(self, pcscf):
+ if len(pcscf) > 0:
+ content = enc_addr_tlv(pcscf)
+ else:
+ # Just the tag value
+ content = '80'
+ rec_size_bytes = self._scc.record_size(EF_ISIM_ADF_map['PCSCF'])
+ data, sw = self._scc.update_record(EF_ISIM_ADF_map['PCSCF'], 1, rpad(content, rec_size_bytes*2))
+ return sw
+
class _MagicSimBase(Card):
"""
@@ -1208,6 +1218,16 @@ class SysmoISIMSJA2(UsimCard, IsimCard):
if p.get('opc'):
self._scc.update_binary('af20', p['opc'], 17)
+ # update EF.P-CSCF in ADF.ISIM
+ if self.file_exists(EF_ISIM_ADF_map['PCSCF']):
+ if p.get('pcscf'):
+ sw = self.update_pcscf(p['pcscf'])
+ else:
+ sw = self.update_pcscf("")
+ if sw != '9000':
+ print("Programming P-CSCF failed with code %s"%sw)
+
+
if '9000' == self.select_adf_by_aid():
# update EF-USIM_AUTH_KEY in ADF.USIM
if p.get('ki'):