I also have to respond to this message with the deliver_sm_resp status. But how can I do it? Here is my code
def received_handler(pdu):\n lambda pdu: sys.stdout.write('--'.format(pdu.short_message))\n pdu_body = pdu.short_message\n pdu_phone = pdu.source_addr\n sms_1 = 'sms %s' % (pdu_body)\n logger.info(sms_1)\n phone_1 = 'phone %s' % (pdu_phone)\n logger.info(phone_1)\n\ntry:\n client = smpplib.client.Client(host,port)\n client.set_message_sent_handler(\n lambda pdu: sys.stdout.write('sent {} {}\\n'.format(pdu.sequence, pdu.message_id)))\n client.set_message_received_handler(received_handler)\n client.connect()\n client.bind_transceiver(system_id=sys_id, password=pwd)\n\n client.listen()\nexcept UnknownCommandError as e:\n logger.error('UnknownCommandError DELIVER SMS')\n deliver = smpplib.smpp.make_pdu('deliver_sm_resp', client=client)\n client.send_pdu(deliver)\n logger.info(\"SEND deliver_sm_resp\")\nexcept Exception as e:\n client.listen()Hi @AnnaLupanova 👋
\nclient.listen() should take care of sending deliver_sm_resp, see \n python-smpplib/smpplib/client.py\n
\n\n Lines 372 to 373\n in\n 7367454\n
\n| \n | elif pdu.command == 'deliver_sm': | \n
| \n | self._message_received(pdu) | \n
UnknownCommandError – we're unfortunately unable to handle vendor-specific command codes at the moment. Here's the tracking issue: #105-
|
Hi. I use python 3.6 and I get this error when sending a delivery report from SMSC. I also have to respond to this message with the def received_handler(pdu):
lambda pdu: sys.stdout.write('--'.format(pdu.short_message))
pdu_body = pdu.short_message
pdu_phone = pdu.source_addr
sms_1 = 'sms %s' % (pdu_body)
logger.info(sms_1)
phone_1 = 'phone %s' % (pdu_phone)
logger.info(phone_1)
try:
client = smpplib.client.Client(host,port)
client.set_message_sent_handler(
lambda pdu: sys.stdout.write('sent {} {}\n'.format(pdu.sequence, pdu.message_id)))
client.set_message_received_handler(received_handler)
client.connect()
client.bind_transceiver(system_id=sys_id, password=pwd)
client.listen()
except UnknownCommandError as e:
logger.error('UnknownCommandError DELIVER SMS')
deliver = smpplib.smpp.make_pdu('deliver_sm_resp', client=client)
client.send_pdu(deliver)
logger.info("SEND deliver_sm_resp")
except Exception as e:
client.listen() |
Beta Was this translation helpful? Give feedback.
-
|
Hi @AnnaLupanova 👋
|
Beta Was this translation helpful? Give feedback.
Hi @AnnaLupanova 👋
client.listen()should take care of sendingdeliver_sm_resp, seepython-smpplib/smpplib/client.py
Lines 372 to 373 in 7367454
UnknownCommandError– we're unfortunately unable to handle vendor-specific command codes at the moment. Here's the tracking issue: #105