mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-30 14:28:10 +03:00
pySim-prog: Honor international '+' in SMSC number
The smsc no. programmed by pySim-prog would always be a national number in the past. Check whether the first 'digit' is a + and indicate that it is an international number. Change-Id: Ia79913f5b0307e9786a5acea75c0811927be2eef
This commit is contained in:
@@ -97,7 +97,7 @@ def parse_options():
|
|||||||
default=55,
|
default=55,
|
||||||
)
|
)
|
||||||
parser.add_option("-m", "--smsc", dest="smsc",
|
parser.add_option("-m", "--smsc", dest="smsc",
|
||||||
help="SMSP [default: '00 + country code + 5555']",
|
help="SMSC number (Start with + for international no.) [default: '00 + country code + 5555']",
|
||||||
)
|
)
|
||||||
parser.add_option("-M", "--smsp", dest="smsp",
|
parser.add_option("-M", "--smsp", dest="smsp",
|
||||||
help="Raw SMSP content in hex [default: auto from SMSC]",
|
help="Raw SMSP content in hex [default: auto from SMSC]",
|
||||||
@@ -319,14 +319,19 @@ def gen_parameters(opts):
|
|||||||
raise ValueError('SMSP must be at least 28 bytes')
|
raise ValueError('SMSP must be at least 28 bytes')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
ton = "81"
|
||||||
if opts.smsc is not None:
|
if opts.smsc is not None:
|
||||||
smsc = opts.smsc
|
smsc = opts.smsc
|
||||||
|
if smsc[0] == '+':
|
||||||
|
ton = "91"
|
||||||
|
smsc = smsc[1:]
|
||||||
if not _isnum(smsc):
|
if not _isnum(smsc):
|
||||||
raise ValueError('SMSC must be digits only !')
|
raise ValueError('SMSC must be digits only!\n \
|
||||||
|
Start with \'+\' for international numbers')
|
||||||
else:
|
else:
|
||||||
smsc = '00%d' % opts.country + '5555' # Hack ...
|
smsc = '00%d' % opts.country + '5555' # Hack ...
|
||||||
|
|
||||||
smsc = '%02d' % ((len(smsc) + 3)//2,) + "81" + swap_nibbles(rpad(smsc, 20))
|
smsc = '%02d' % ((len(smsc) + 3)//2,) + ton + swap_nibbles(rpad(smsc, 20))
|
||||||
|
|
||||||
smsp = (
|
smsp = (
|
||||||
'e1' + # Parameters indicator
|
'e1' + # Parameters indicator
|
||||||
|
|||||||
Reference in New Issue
Block a user