Skip to content
\n

I also have to respond to this message with the deliver_sm_resp status. But how can I do it? Here is my code

\n
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()
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

Hi @AnnaLupanova 👋

\n
    \n
  1. client.listen() should take care of sending deliver_sm_resp, see
    \n
    \n

    \n python-smpplib/smpplib/client.py\n

    \n

    \n Lines 372 to 373\n in\n 7367454\n

    \n
    \n
    \n \n\n \n \n \n \n\n \n \n \n \n
    elif pdu.command == 'deliver_sm':
    self._message_received(pdu)
    \n
    \n
    \n
  2. \n
  3. As for the UnknownCommandError – we're unfortunately unable to handle vendor-specific command codes at the moment. Here's the tracking issue: #105
  4. \n
","upvoteCount":1,"url":"https://github.com/python-smpplib/python-smpplib/discussions/191#discussioncomment-2191615"}}}
Discussion options

You must be logged in to vote

Hi @AnnaLupanova 👋

  1. client.listen() should take care of sending deliver_sm_resp, see
    elif pdu.command == 'deliver_sm':
    self._message_received(pdu)
  2. 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

Comment options

You must be logged in to vote
0 replies
Answer selected by eigenein
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #190 on February 16, 2022 20:44.