Created
March 18, 2024 15:06
-
-
Save Takuto88/1a58d7a5acf577f8b54c9f08156b1216 to your computer and use it in GitHub Desktop.
SMPP SMS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
smpplib==2.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from smpplib.client import Client | |
from smpplib import consts | |
from smpplib import gsm | |
from os import environ | |
def app(): | |
username = environ['SMPP_USERNAME'] | |
password = environ['SMPP_PASSWORD'] | |
client = Client('localhost', 2775) | |
client.connect() | |
client.bind_transceiver(system_id=username, password=password) | |
parts, encoding_flag, msg_type_flag = gsm.make_parts(u'Hallo Welt!\n') | |
pdu = client.send_message( | |
source_addr_ton=consts.SMPP_TON_INTL, | |
source_addr='+1234567890', | |
dest_addr_ton=consts.SMPP_TON_INTL, | |
destination_addr='49156780000', | |
short_message=parts[0], | |
data_coding=encoding_flag, | |
esm_class=msg_type_flag, | |
registered_delivery=True | |
) | |
print(pdu.sequence) | |
client.listen() | |
if __name__ == "__main__": | |
app() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment