jookies / jasmin

Jasmin - Open source SMS gateway
http://jasminsms.com
Other
1.04k stars 558 forks source link

PDUParseError while using SMPPSimulator #269

Closed sotoz closed 9 years ago

sotoz commented 9 years ago

Hello. I have added an smpp connector to the SMPPSimulator by Selenium to test big bulk sms sending. The SMPPSimulator is running locally on the server and I'm seeing some errors on the default-smppsim.log file when sending > 1000 messages. As far as I have seen, this error only appeared when I used the route that has the smpp simulator. When sending to real smscs I haven't seen that error at all.

Maybe the problem exists on the smpp simulator that doesn't sends correct PDUs back to jasmin?

2015-07-23 17:02:00 ERROR    23686 Error in the optional part of the PDU Body: Unknown tag value 0x1403
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/twisted/protocol.py", line 195, in rawMessageReceived
    pdu = self.encoder.decode(StringIO.StringIO(message))
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 935, in decode
    self.decodeBody(file, pdu, headerParams['command_length'] - self.HEADER_LEN)
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 975, in decodeBody
    optionalParams = self.decodeOptionalParams(pdu.optionalParams, file, bodyLength - mParamsLen)
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 1022, in decodeOptionalParams
    option = self.optionEncoder.decode(file)
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 826, in decode
    tag = TagEncoder().decode(file)
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 96, in decode
    return self._decode(bytes)
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 265, in _decode
    raise self.decodeErrorClass(errStr, self.decodeErrorStatus)
PDUParseError: Error in the optional part of the PDU Body: Unknown tag value 0x1403
2015-07-23 17:02:00 CRITICAL 23686 Received unparsable PDU 000000b7000000050000000000000464000101313233000201534f5449524953000400000000000001007069643a31313230207375623a30303120646c7672643a303031207375626d697420646174653a3135303732333137303120646f6e6520646174653a3135303732333137303120737461743a44454c49565244206572723a30303020546578743a5445cea3542045ce9bce9b484e494b41001e0005313132300004270001021403000a34343132333435363738
farirat commented 9 years ago

Can you provide a pcap capture where i can see the flow between jasmin and your simulator ?

farirat commented 9 years ago

UP

sotoz commented 9 years ago

Hi, sorry for not responding fast. I have managed to extract a part of the SMPPsimulator logfile of an erroneous send sms attempt.

2015.08.03 12:39:09 904 INFO    20 : Standard SUBMIT_SM:
2015.08.03 12:39:09 904 INFO    20 Hex dump (59) bytes:
2015.08.03 12:39:09 904 INFO    20 0000003B:00000004:00000000:00000036:
2015.08.03 12:39:09 905 INFO    20 00020153:4F544952:49530001:01313233:
2015.08.03 12:39:09 905 INFO    20 00030000:00000100:01001054:45CEA354:
2015.08.03 12:39:09 905 INFO    20 2045CE9B:CE9B484E:494B41
2015.08.03 12:39:09 906 INFO    20 cmd_len=59,cmd_id=4,cmd_status=0,seq_no=54,service_type=,source_addr_ton=2
2015.08.03 12:39:09 906 INFO    20 source_addr_npi=1,source_addr=SOTIRIS,dest_addr_ton=1,dest_addr_npi=1
2015.08.03 12:39:09 906 INFO    20 dest_addr=123,esm_class=3,protocol_ID=0,priority_flag=0,schedule_delivery_time=
2015.08.03 12:39:09 907 INFO    20 validity_period=,registered_delivery_flag=1,replace_if_present_flag=0
2015.08.03 12:39:09 907 INFO    20 data_coding=1,sm_default_msg_id=0,sm_length=16,short_message=TEΣT EΛΛHNIKA
2015.08.03 12:39:09 908 INFO    20  
2015.08.03 12:39:09 908 INFO    20 Validity period is not set: defaulting to 5 minutes from now
2015.08.03 12:39:09 909 INFO    20 Generated default validity period=150803124409000+
2015.08.03 12:39:09 909 INFO    23 Assessing state of 1 messages in the OutboundQueue
2015.08.03 12:39:09 909 INFO    20 :SUBMIT_SM_RESP:
2015.08.03 12:39:09 909 INFO    20 Hex dump (18) bytes:
2015.08.03 12:39:09 910 INFO    20 00000012:80000004:00000000:00000036:
2015.08.03 12:39:09 910 INFO    20 3900
2015.08.03 12:39:09 910 INFO    20 cmd_len=0,cmd_id=-2147483644,cmd_status=0,seq_no=54,message_id=9
2015.08.03 12:39:09 910 INFO    20  
2015.08.03 12:39:09 914 INFO    20 SubmitSM processing - response written to connection
2015.08.03 12:39:14 909 INFO    23 Assessing state of 1 messages in the OutboundQueue
2015.08.03 12:39:14 910 INFO    23 Message:54 state=DELIVERED
2015.08.03 12:39:14 910 INFO    23 Delivery Receipt requested
2015.08.03 12:39:17 299 INFO    22 addressIsServicedByReceiver(SOTIRIS)
2015.08.03 12:39:17 300 INFO    22 DELIVER_SM (receipt):
2015.08.03 12:39:17 300 INFO    22 Hex dump (177) bytes:
2015.08.03 12:39:17 300 INFO    22 000000B1:00000005:00000000:0000000A:
2015.08.03 12:39:17 303 INFO    22 00010131:32330002:01534F54:49524953:
2015.08.03 12:39:17 303 INFO    22 00040000:00000000:01006D69:643A3920:
2015.08.03 12:39:17 303 INFO    22 7375623A:30303120:646C7672:643A3030:
2015.08.03 12:39:17 307 INFO    22 31207375:626D6974:20646174:653A3135:
2015.08.03 12:39:17 307 INFO    22 30383033:31323339:20646F6E:65206461:
2015.08.03 12:39:17 307 INFO    22 74653A31:35303830:33313233:39207374:
2015.08.03 12:39:17 308 INFO    22 61743A44:454C4956:52442065:72723A30:
2015.08.03 12:39:17 308 INFO    22 30302054:6578743A:5445CEA3:542045CE:
2015.08.03 12:39:17 308 INFO    22 9BCE9B48:4E494B41:001E0002:39000427:
2015.08.03 12:39:17 308 INFO    22 00010214:03000A34:34313233:34353637:
2015.08.03 12:39:17 309 INFO    22 38
2015.08.03 12:39:17 309 INFO    22 cmd_len=0,cmd_id=5,cmd_status=0,seq_no=10,service_type=,source_addr_ton=1
2015.08.03 12:39:17 309 INFO    22 source_addr_npi=1,source_addr=123,dest_addr_ton=2,dest_addr_npi=1
2015.08.03 12:39:17 310 INFO    22 destination_addr=SOTIRIS,esm_class=4,protocol_ID=0,priority_flag=0
2015.08.03 12:39:17 310 INFO    22 schedule_delivery_time=,validity_period=,registered_delivery_flag=0
2015.08.03 12:39:17 315 INFO    22 replace_if_present_flag=0,data_coding=1,sm_default_msg_id=0,sm_length=109
2015.08.03 12:39:17 315 INFO    22 short_message=id:9 sub:001 dlvrd:001 submit date:1508031239 done date:1508031239 stat:DELIVRD err:000 Text:TEΣT EΛΛHNIKA
2015.08.03 12:39:17 315 INFO    22 TLV=30/2/3900,TLV=1063/1/02,TLV=5123/10/34343132333435363738
2015.08.03 12:39:17 317 INFO    22  
2015.08.03 12:39:17 322 INFO    20 : DELIVER_SM_RESP:
2015.08.03 12:39:17 323 INFO    20 Hex dump (17) bytes:
2015.08.03 12:39:17 323 INFO    20 00000011:80000005:000000C0:0000000A:
2015.08.03 12:39:17 323 INFO    20 00
2015.08.03 12:39:17 323 INFO    20 cmd_len=17,cmd_id=-2147483643,cmd_status=192,seq_no=10,system_id=
2015.08.03 12:39:17 323 INFO    20  
2015.08.03 12:39:17 324 INFO    22 InboundQueue: empty  - waiting
2015.08.03 12:39:19 910 INFO    23 Assessing state of 1 messages in the OutboundQueue

The message on jasmin got reported like that:

2015-08-03 12:39:17 ERROR    1239 Error in the optional part of the PDU Body: Unknown tag value 0x1403
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/twisted/protocol.py", line 195, in rawMessageReceived
    pdu = self.encoder.decode(StringIO.StringIO(message))
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 935, in decode
    self.decodeBody(file, pdu, headerParams['command_length'] - self.HEADER_LEN)
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 975, in decodeBody
    optionalParams = self.decodeOptionalParams(pdu.optionalParams, file, bodyLength - mParamsLen)
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 1022, in decodeOptionalParams
    option = self.optionEncoder.decode(file)
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 826, in decode
    tag = TagEncoder().decode(file)
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 96, in decode
    return self._decode(bytes)
  File "/usr/local/lib/python2.7/site-packages/jasmin/vendor/smpp/pdu/pdu_encoding.py", line 265, in _decode
    raise self.decodeErrorClass(errStr, self.decodeErrorStatus)
PDUParseError: Error in the optional part of the PDU Body: Unknown tag value 0x1403
2015-08-03 12:39:17 CRITICAL 1239 Received unparsable PDU 000000b100000005000000000000000a000101313233000201534f5449524953000400000000000001006d69643a39207375623a30303120646c7672643a303031207375626d697420646174653a3135303830333132333920646f6e6520646174653a3135303830333132333920737461743a44454c49565244206572723a30303020546578743a5445cea3542045ce9bce9b484e494b41001e0002390004270001021403000a34343132333435363738

I don't know if this is enough to help you. I can try a tcpdump if you can give me some help on how to correctly get the PDU.

farirat commented 9 years ago

This is clearly a vendor-specific TLV, which is displayed here:

2015.08.03 12:39:17 315 INFO    22 TLV=30/2/3900,TLV=1063/1/02,TLV=5123/10/34343132333435363738

Those 3 TLV tags are not accepted by Jasmin.

sotoz commented 9 years ago

So, what can I do to use the SMPPsimulator with Jasmin? I need it to test massive bulk sms sending with my infrastructure. Are there any other alternatives that I can use to simulate real smpp connections?

farirat commented 9 years ago

Sent you a SMPPSim through email

cubezero commented 7 years ago

It would be great if you provide simulator for public download as any developer is testing your solution before deciding "to eat or not to eat". So if it works not good with some third-party simulator, somebody could think it does the same with real smpp services. Regarding the case with vendor-specific TLVs - from my experience based on working with few smscs around the world - much vendors uses specific TLVs and this is not the reason to throw errors - yes, those TLVs could be skipped and logged, but PDU should be processed somehow I think.

ivanrvpereira commented 7 years ago

I have a docker-compose recipe with Jasmin, RabbitMQ, Redis and SMPPsim integrated. I can share with you if you want.

bss-haresh-makwana commented 7 months ago

SMPPsim

Yes, can you share with me.