- 
 
- 
  Notifications
 You must be signed in to change notification settings 
- Fork 140
smpplib.exceptions.UnknownCommandError: Unknown SMPP command code "0x2001" #191
 
 
 
 
 Answered
 
 by
 eigenein
 
 
 
 
 
 AnnaLupanova
 
 
 
 asked this question in
 Q&A
 
 -
Hi. I use python 3.6 and I get this error when sending a delivery report from SMSC.
Traceback (most recent call last):
 File "/usr/local/lib/python3.6/site-packages/smpplib-2.2.1-py3.6.egg/smpplib/client.py", line 401, in listen
 File "/usr/local/lib/python3.6/site-packages/smpplib-2.2.1-py3.6.egg/smpplib/client.py", line 355, in read_once
 File "/usr/local/lib/python3.6/site-packages/smpplib-2.2.1-py3.6.egg/smpplib/client.py", line 268, in read_pdu
 File "/usr/local/lib/python3.6/site-packages/smpplib-2.2.1-py3.6.egg/smpplib/smpp.py", line 41, in parse_pdu
 File "/usr/local/lib/python3.6/site-packages/smpplib-2.2.1-py3.6.egg/smpplib/pdu.py", line 127, in parse
 File "/usr/local/lib/python3.6/site-packages/smpplib-2.2.1-py3.6.egg/smpplib/command.py", line 315, in parse_params
 File "/usr/local/lib/python3.6/site-packages/smpplib-2.2.1-py3.6.egg/smpplib/command.py", line 333, in parse_optional_params
 File "/usr/local/lib/python3.6/site-packages/smpplib-2.2.1-py3.6.egg/smpplib/command.py", line 71, in get_optional_name
smpplib.exceptions.UnknownCommandError: Unknown SMPP command code "0x2001"
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): 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.
All reactions
 
 
 Answered by
 
 eigenein
 
 
 
 Feb 16, 2022 
 
 
 Hi @AnnaLupanova 👋
- 
client.listen()should take care of sendingdeliver_sm_resp, seepython-smpplib/smpplib/client.py Lines 372 to 373 in 7367454 elif pdu.command == 'deliver_sm':self._message_received(pdu)
- As for the UnknownCommandError– we're unfortunately unable to handle vendor-specific command codes at the moment. Here's the tracking issue: #105
Replies: 1 comment
-
Hi @AnnaLupanova 👋
- client.listen()should take care of sending- deliver_sm_resp, see- python-smpplib/smpplib/client.py - Lines 372 to 373 in 7367454 elif pdu.command == 'deliver_sm':self._message_received(pdu)
- As for the UnknownCommandError– we're unfortunately unable to handle vendor-specific command codes at the moment. Here's the tracking issue: Handle vendor-specific command codes #105
Beta Was this translation helpful? Give feedback.
All reactions
 
 0 replies
 
 
 
 Answer selected by
 eigenein
 
 Sign up for free
 to join this conversation on GitHub.
 Already have an account?
 Sign in to comment