Closed mknithin closed 2 years ago
@mknithin which file did you edit?
smpp/pdu/pdu_types.py, you have to edit this file.
I am using 0.10.9 there is no such file. Which version are you using?
I realized it was outside of jasmin. I had to edit the smpp package. Thanks @mknithin
We are also experiencing this issue. @farirat any chance we get this fix into the main branch?
hello,
Within smpp.pdu.constants, i can see the priority_flag_name_map is correctly defined:
priority_flag_name_map = { 'LEVEL_0': 0x00, 'LEVEL_1': 0x01, 'LEVEL_2': 0x02, 'LEVEL_3': 0x03, }
And in smpp.pdu.pdu_types, is PriorityFlag correctly defined as well:
PriorityFlag = Enum('PriorityFlag', list(constants.priority_flag_name_map.keys()))
From smpp 3.4 protocol specification, _5.2.14 priority_flag_:
Four Priority Levels are supported:
The Jasmin implementation is compliant and doesnt take in charge reserved values, which i guess, are vendor specific and not protocol based.
Thanks @farirat, responding on @michaeltoop behalf.
The mapping is correct, however the enum behavior is starting at 1. All our inbound SMPP sms's come in as Priority=0, in jasmin logs, they are set to 1:
2022-02-24 11:46:27 INFO 1198724 SMS-MO [cid:smsc] [queue-msgid:69cab7a4-a569-41bc-98af-e747a793edd5] [status:CommandStatus.ESME_ROK] [prio:1] [validity:2022-02-26 13:26:17+02:00] [from:b'27670111111'] [to:b'27600111111'] [content:b'xxxx']
In the event that a user sends with Priority=3, Jasmin sees it as 4 and fails as per original issue.
If we set the enum to start=0
, jasmin sets the priority accordingly, however the log format is map name and not the value:
2022-03-01 10:02:37 INFO 1252066 SMS-MO [cid:neotel_smsc] [queue-msgid:1a6eeb5d-fda6-466b-8695-c8d9b662824b] [status:CommandStatus.ESME_ROK] [prio:PriorityFlag.LEVEL_0] [validity:2022-03-03 11:42:04+02:00] [from:b'27731111111'] [to:b'27600111111'] [content:b'zxxx']
Hope this clarifies.
This issue is duplicated to jookies/jasmin#971 Fixing it will be covered in original issue.
There is mapping error in PriorityFlag Enumeration , PriorityFlag enumeration value mappings are starting from 1.
Due to this issue , if we choose priority value 3 in jasmin sms request, the value receive will be 4 and thus it's failing the validation and causing the below exception.
Traceback (most recent call last):, File "/usr/local/lib/python3.9/site-packages/jasmin/protocols/smpp/factory.py", line 333, in submit_sm_event_interceptor, return self.submit_sm_post_interception(routable=routable, system_id=system_id, proto=proto), File "/usr/local/lib/python3.9/site-packages/jasmin/protocols/smpp/factory.py", line 474, in submit_sm_post_interception, c = self.SMPPClientManagerPB.perspective_submit_sm(, File "/usr/local/lib/python3.9/site-packages/twisted/internet/defer.py", line 1613, in unwindGenerator, return _cancellableInlineCallbacks(gen), File "/usr/local/lib/python3.9/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks, _inlineCallbacks(None, g, status), --- <exception caught here> ---, File "/usr/local/lib/python3.9/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks, result = g.send(result), File "/usr/local/lib/python3.9/site-packages/jasmin/managers/clients.py", line 581, in perspective_submit_sm, c = SubmitSmContent(, File "/usr/local/lib/python3.9/site-packages/jasmin/managers/content.py", line 154, in __init__, raise InvalidParameterError("Priority must be set from 0 to 3, it is actually set to %s" %, jasmin.managers.content.InvalidParameterError: Priority must be set from 0 to 3, it is actually set to 4,
This issue can be fixed by replacing the pdu_types module code
PriorityFlag = Enum('PriorityFlag', list(constants.priority_flag_name_map.keys()))
with;
PriorityFlag = Enum('PriorityFlag', list(constants.priority_flag_name_map.keys()),start=0)
I've tried creating a pull request but seems like no permission to do that .
Please make this changes to avoid this error .
Thanks.