Skip to content

Get message_id when sending sms #245

@micartey

Description

@micartey

The example contains the following snipped for sending a SMS:

for part in parts:
    pdu = client.send_message(
        source_addr_ton=smpplib.consts.SMPP_TON_INTL,
        #source_addr_npi=smpplib.consts.SMPP_NPI_ISDN,
        # Make sure it is a byte string, not unicode:
        source_addr='SENDERPHONENUM',

        dest_addr_ton=smpplib.consts.SMPP_TON_INTL,
        #dest_addr_npi=smpplib.consts.SMPP_NPI_ISDN,
        # Make sure thease two params are byte strings, not unicode:
        destination_addr='PHONENUMBER',
        short_message=part,

        data_coding=encoding_flag,
        esm_class=msg_type_flag,
        registered_delivery=True,
    )
    print(pdu.sequence)

Is it somehow possible to get the message_id that will be later echoed as receipted_message_id at this point?
I know that I can use the following listener:

client.set_message_sent_handler(
    lambda pdu: logger.debug(f"sent {pdu.message_id}")
)

But I cannot know if the message_id is the message id for the message I just sent in a multi-threaded environment 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions