Change in pysim[master]: pySim-prog: Honor international '+' in SMSC number

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

daniel gerrit-no-reply at lists.osmocom.org
Fri Oct 5 12:21:25 UTC 2018


daniel has submitted this change and it was merged. ( https://gerrit.osmocom.org/11201 )

Change subject: pySim-prog: Honor international '+' in SMSC number
......................................................................

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
---
M pySim-prog.py
1 file changed, 8 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



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 @@
 			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 @@
 			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

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia79913f5b0307e9786a5acea75c0811927be2eef
Gerrit-Change-Number: 11201
Gerrit-PatchSet: 3
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181005/968bdcd6/attachment.htm>


More information about the gerrit-log mailing list