[S] Change in pysim[master]: cat: add sms_pp_download_envelope()
Hoernchen has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/43557?usp=email ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: cat: add sms_pp_download_envelope() ...................................................................... cat: add sms_pp_download_envelope() Put a helper for wrapping an SMS-DELIVER TPDU in the ENVELOPE of TS 102 223 section 7.5.1 the assembly next to SMSPPDownload, where the IEs already live, so it can be reused by other tooling, for example for triggering scp81 sessions. Change-Id: Id23227eac53d697f4f13a84e087c32bf1d60f474 --- M pySim-smpp2sim.py M pySim/cat.py 2 files changed, 18 insertions(+), 4 deletions(-) Approvals: Jenkins Builder: Verified dexter: Looks good to me, approved laforge: Looks good to me, but someone else must approve diff --git a/pySim-smpp2sim.py b/pySim-smpp2sim.py index f7a45f5..95b9ccd 100755 --- a/pySim-smpp2sim.py +++ b/pySim-smpp2sim.py @@ -55,6 +55,7 @@ from pySim.commands import SimCardCommands from pySim.cards import UiccCardBase from pySim.exceptions import * +from pySim.cat import sms_pp_download_envelope from pySim.cat import ProactiveCommand, SendShortMessage, SMS_TPDU, SMSPPDownload, BearerDescription from pySim.cat import DeviceIdentities, Address, OtherAddress, UiccTransportLevel, BufferSize from pySim.cat import ChannelStatus, ChannelData, ChannelDataLength @@ -169,10 +170,7 @@ tpdu = SMS_DELIVER.from_smpp_submit(pdu) logger.info(tpdu) # 2) wrap into the CAT ENVELOPE for SMS-PP-Download - tpdu_ie = SMS_TPDU(decoded={'tpdu': b2h(tpdu.to_bytes())}) - addr_ie = Address(decoded={'ton_npi': {'ext':False, 'type_of_number':'unknown', 'numbering_plan_id':'unknown'}, 'call_number': '0123456'}) - dev_ids = DeviceIdentities(decoded={'source_dev_id': 'network', 'dest_dev_id': 'uicc'}) - sms_dl = SMSPPDownload(children=[dev_ids, addr_ie, tpdu_ie]) + sms_dl = sms_pp_download_envelope(tpdu) # 3) send to the card envelope_hex = b2h(sms_dl.to_tlv()) logger.info("ENVELOPE: %s" % envelope_hex) diff --git a/pySim/cat.py b/pySim/cat.py index d755545..8959004 100644 --- a/pySim/cat.py +++ b/pySim/cat.py @@ -763,6 +763,22 @@ nested=[DeviceIdentities, Address, SMS_TPDU]): pass + +def sms_pp_download_envelope(tpdu, call_number: str = '0123456') -> SMSPPDownload: + """TS 31.111 Section 7.1.1.2 wrap of a SMS-DELIVER TPDU in the ENVELOPE (SMS-PP Download) + call_number : + SMSC address to report, defined in TS 31.111 7.1.1.2 as + "the RP_Originating_Address of the Service Centre (TS-Service-Centre-Address, 3GPP TS 24.011)" + its presence is Conditional, and the note there says the UICC should be fine + if its missing, so for remote management its presence should suffice (?). + """ + return SMSPPDownload(children=[ + DeviceIdentities(decoded={'source_dev_id': 'network', 'dest_dev_id': 'uicc'}), + Address(decoded={'ton_npi': {'ext': False, 'type_of_number': 'unknown', + 'numbering_plan_id': 'unknown'}, + 'call_number': call_number}), + SMS_TPDU(decoded={'tpdu': b2h(tpdu.to_bytes())})]) + # TS 101 220 Table 7.17 + 31.111 7.1.1.3 class SMSCBDownload(BER_TLV_IE, tag=0xD2, nested=[DeviceIdentities, CBSPage]): -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43557?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Id23227eac53d697f4f13a84e087c32bf1d60f474 Gerrit-Change-Number: 43557 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild@sysmocom.de> Gerrit-Reviewer: Hoernchen <ewild@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier@sysmocom.de> Gerrit-Reviewer: laforge <laforge@osmocom.org>
participants (1)
-
Hoernchen