Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

how do i get received messages status like From, to , message, received time sent from mobiles(MO) #140

Answered by primeKal
kalebtade asked this question in Q&A
Discussion options

logging.basicConfig(level='DEBUG')
parts, encoding_flag, msg_type_flag = smpplib.gsm.make_parts(u'test')
client = smpplib.client.Client('*********', **** allow_unknown_opt_params=True)
client.set_message_sent_handler(
 lambda pdu: sys.stdout.write('sent {} {}\n'.format(pdu.sequence, pdu.message_id)))
client.set_message_received_handler(
 lambda pdu: sys.stdout.write('delivered {}\n'.format(pdu.short_message)))
 
client.connect()
client.bind_transceiver(system_id='****', password='****')
dist=['1', '2','3','4','5']
for phone in dist:
 for part in parts:
 pdu = client.send_message(
 source_addr_ton=smpplib.consts.SMPP_TON_NWSPEC,
 source_addr_npi=smpplib.consts.SMPP_NPI_UNK, 
 source_addr='****',
 dest_addr_ton=smpplib.consts.SMPP_TON_INTL,
 dest_addr_npi=smpplib.consts.SMPP_NPI_ISDN,
 destination_addr=phone,
 short_message=part,
 data_coding=encoding_flag,
 esm_class=msg_type_flag,
 registered_delivery=1,
 )
 print(pdu.sequence)
client.listen()
You must be logged in to vote

You are passed with PDU object when setting the message received method so u can do what ever you want with the values . example source_address = pdu.source_addr .... pretty simple actually

Replies: 1 comment

Comment options

You are passed with PDU object when setting the message received method so u can do what ever you want with the values . example source_address = pdu.source_addr .... pretty simple actually

You must be logged in to vote
0 replies
Answer selected by eigenein
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Converted from issue

This discussion was converted from issue #129 on July 05, 2021 12:17.

AltStyle によって変換されたページ (->オリジナル) /