Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def gen_tpdu(ref, to, text, empty):
# TP-PID = 40 ==> short message type 0
# TP-DCS = c3 ==> disable "other message indicator" and discard message
if empty:
text = ""
TPPID = 0x40 if empty else 0
TPDCS = 0xc3 if empty else 0
pdu = SMS_SUBMIT.create(None, to, text, tp_pid=TPPID, tp_dcs=TPDCS).toPDU()
return [pdu]
def parse(rp_message):
rpdu = RPDU.fromPDU(rp_message)
sms_submit = SMS_SUBMIT.fromPDU(rpdu.user_data, rpdu.rp_originator_address)
exports = [
("vbts_text", sms_submit.user_data),
("vbts_tp_user_data", smspdu_charstring_to_hex(sms_submit.tp_ud)),
("vbts_tp_data_coding_scheme", sms_submit.tp_dcs),
("vbts_tp_protocol_id", sms_submit.tp_pid),
("vbts_tp_dest_address", sms_submit.tp_da),
("vbts_tp_dest_address_type", sms_submit.tp_toa),
("vbts_tp_message_type", sms_submit.tp_mti),
("vbts_rp_dest_address", rpdu.rp_destination_address),
("vbts_rp_originator_address", rpdu.rp_originator_address),
("vbts_rp_originator_address_type", rpdu.rp_originator_address_type),
("vbts_rp_message_reference", rpdu.rp_message_reference),
("vbts_rp_message_type", rpdu.rp_mti)
]
exports = [(x, clean(y)) for (x, y) in exports]
return exports