Skip to content

Instantly share code, notes, and snippets.

@Takuto88
Created March 18, 2024 15:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Takuto88/1a58d7a5acf577f8b54c9f08156b1216 to your computer and use it in GitHub Desktop.
Save Takuto88/1a58d7a5acf577f8b54c9f08156b1216 to your computer and use it in GitHub Desktop.
SMPP SMS
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