-
-
Notifications
You must be signed in to change notification settings - Fork 143
Description
import smpplib.client
import smpplib.consts
Initialize your SMPP client
client = smpplib.client.Client('127.0.01', 2775, allow_unknown_opt_params=True)
client.connect()
try:
# Bind to the SMPP server with credentials
client.bind_transceiver(system_id='sarimali', password='password')
# Query the delivery status for a specific message ID
message_id_to_check = '2C16E7kk'
# Sending the query request
status = client.query_message(
message_id=message_id_to_check,
source_addr_ton=5,
source_addr_npi=0,
source_addr='Dar'
)
# Interpret the status and print the result
client.listen()
if status.status == 0:
delivery_status = "Delivered" if status.status else "Not Delivered"
print(f"Delivery Status: {delivery_status}")
else:
print("Query Failed")
except smpplib.exceptions.PDUError as e:
print(f"Error querying delivery status: {e}")
finally:
client.disconnect()
-----------------Response-------------------------
<smpplib.client.Client object at 0x000001D7D08520D0> is disconnecting in the bound state
Error querying delivery status: ('(12) query_sm_resp: Invalid Message ID', 12)