komuw / naz

naz is an async SMPP client.
https://komuw.github.io/naz/
MIT License
39 stars 12 forks source link

Issues/189: add ability to supply submit_sm SMSC fields during submit_sm call #193

Closed komuw closed 4 years ago

komuw commented 4 years ago

Thank you for contributing to naz.
Every contribution to naz is important.

Contributions are under the MIT License.

Answer the following questions,

What(What have you changed?)

Why(Why did you change it?)

References:

komuw commented 4 years ago
er_sm', 'log_id': '', 'command_status': 0, 'state': 'Success'}
{'timestamp': '2019-12-05 19:19:37,056', 'event': 'naz.Client.deliver_sm_resp', 'stage': 'start', 'log_id': '7x5em1nr8z5uxt5o7', 'smpp_command': 'deliver_sm_resp'}
{'timestamp': '2019-12-05 19:19:37,057', 'event': 'naz.Client.deliver_sm_resp', 'stage': 'end', 'error': "'utf-8' codec can't decode byte 0x80 in position 4: invalid start byte", 'log_id': '7x5em1nr8z5uxt5o7', 'smpp_command': 'deliver_sm_resp'}
Traceback (most recent call last):
  File "/home/komuw/mystuff/naz/naz/client.py", line 961, in deliver_sm_resp
    pdu=full_pdu,
  File "/home/komuw/mystuff/naz/examples/example_klasses.py", line 103, in enqueue
    await _redis.lpush(self.queue_name, message.to_json())
  File "/home/komuw/mystuff/naz/naz/protocol.py", line 383, in to_json
    pdu=self.pdu.decode(self.ENCODING),
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 4: invalid start byte
{'timestamp': '2019-12-05 19:19:37,059', 'event': 'naz.Client.deliver_sm_resp', 'stage': 'end', 'log_id': '7x5em1nr8z5uxt5o7', 'smpp_command': 'deliver_sm_resp'}
{'timestamp': '2019-12-05 19:19:37,059', 'event': 'naz.Client.receive_data', 'stage': 'end'}
{'timestamp': '2019-12-05 19:19:37,060', 'event': 'naz.Clien

when you inject a deliver_sm request from smpp mock server

komuw commented 4 years ago
full_pdu = b'\x00\x00\x00\x11\x80\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00A\x00'
full_pdu.decode('utf8')
*** UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 4: invalid start byte
komuw commented 4 years ago
full_pdu = b'\x00\x00\x00\x11\x80\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00A\x00'
full_pdu.decode('utf8')
*** UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 4: invalid start byte

We no longer(as of this PR) send any bytes to the broker.