diff options
author | Daniel Willmann <daniel@totalueberwachung.de> | 2018-10-02 18:10:21 +0200 |
---|---|---|
committer | Daniel Willmann <daniel@totalueberwachung.de> | 2018-10-05 13:19:17 +0200 |
commit | 4fa8f1c49bd3a1abee0df2799c0a553e547a5c94 (patch) | |
tree | 692887b15aca49c3ea96560613607ed7d3ec4c09 | |
parent | 0ec147513c453e1a5a39133494427c0d84f396be (diff) |
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
-rwxr-xr-x | pySim-prog.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/pySim-prog.py b/pySim-prog.py index eca8b4e..ae5e482 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -97,7 +97,7 @@ def parse_options(): default=55, ) 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", 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') else: + ton = "81" if opts.smsc is not None: smsc = opts.smsc + if smsc[0] == '+': + ton = "91" + smsc = smsc[1:] 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: 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 = ( 'e1' + # Parameters indicator |