jookies / jasmin

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

unable to get level 2 DLR #1041

Closed kiswend closed 4 months ago

kiswend commented 2 years ago

Discussed in https://github.com/jookies/jasmin/discussions/1040

Originally posted by **kiswend** March 20, 2022 I'm using the docker image provided in dockerhub (https://hub.docker.com/r/jookies/jasmin).I configured jasmin to connect to a SMPP server. Sending SMS from the http API is successful. However I'm not able to receive level 2 DLR for delivered SMS. I'm receiving only the level 1 DLR. As you can see in the logs, I'm sending all the rquired parameters in the http request. but the PDU in the picture shows jasmin is not requesting the DLR to the SMPP server. Did I miss something in my setup? -- 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 Rendering /send response with args: {b'username': [b'app'], b'password': [b'***'], **b'dlr': [b'yes'], b'dlr-level': [b'3'], b'dlr-method': [b'GET'], b'dlr-url': [b'http://dlrserver/dlr/MTDLR']**, b'from': [b'3364'], b'to': [b'22********'], b'content': [b'Hello'], b'validity-period': [b'15']} from 172.25.0.1 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 Built base SubmitSmPDU: PDU [command: CommandId.submit_sm, sequence_number: None, command_status: CommandStatus.ESME_ROK 2022-03-20 08:27:16 service_type: None 2022-03-20 08:27:16 source_addr_ton: 2022-03-20 08:27:16 source_addr_npi: 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 Executing redis command: ('HMSET', 'dlr:99e84346-72a7-4a7e-a499-7cb6c4e28251', 'sc', 'httpapi', 'url', b'http://dlrserver/dlr/MTDLR', 'level', 3, 'method', b'GET', 'connector', 'SMPP_SVR', 'expiry', 86400) 2022-03-20 08:27:16 source_addr: b'3364' 2022-03-20 08:27:16 dest_addr_ton: 2022-03-20 08:27:16 dest_addr_npi: 2022-03-20 08:27:16 destination_addr: b'22********' 2022-03-20 08:27:16 esm_class: EsmClass[mode: EsmClassMode.STORE_AND_FORWARD, type: EsmClassType.DEFAULT, gsmFeatures: set()] 2022-03-20 08:27:16 protocol_id: None 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 Requested config for connector [SMPP_SVR] 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 getConnector [SMPP_SVR] returned a connector 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 getConnector [SMPP_SVR] returned a connector 2022-03-20 08:27:16 priority_flag: 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 Publishing SubmitSmPDU with routing_key=submit.sm.SMPP_SVR, priority=0 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 Setting DLR url (b'http://dlrserver/dlr/MTDLR') and level (3) for message id:99e84346-72a7-4a7e-a499-7cb6c4e28251, expiring in 86400 2022-03-20 08:27:16 schedule_delivery_time: None 2022-03-20 08:27:16 validity_period: None 2022-03-20 08:27:16 registered_delivery: RegisteredDelivery[receipt: RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED, smeOriginatedAcks: set(), intermediateNotification: False] 2022-03-20 08:27:16 replace_if_present_flag: 2022-03-20 08:27:16 data_coding: 0 2022-03-20 08:27:16 sm_default_msg_id: 0 2022-03-20 08:27:16 short_message: b'Hello' 2022-03-20 08:27:16 ] 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 Built Routable for SubmitSmPDU: PDU [command: CommandId.submit_sm, sequence_number: None, command_status: CommandStatus.ESME_ROK 2022-03-20 08:27:16 service_type: None 2022-03-20 08:27:16 source_addr_ton: 2022-03-20 08:27:16 source_addr_npi: 2022-03-20 08:27:16 source_addr: b'3364' 2022-03-20 08:27:16 dest_addr_ton: 2022-03-20 08:27:16 dest_addr_npi: 2022-03-20 08:27:16 destination_addr: b'22********' 2022-03-20 08:27:16 esm_class: EsmClass[mode: EsmClassMode.STORE_AND_FORWARD, type: EsmClassType.DEFAULT, gsmFeatures: set()] 2022-03-20 08:27:16 protocol_id: None 2022-03-20 08:27:16 priority_flag: 2022-03-20 08:27:16 schedule_delivery_time: None 2022-03-20 08:27:16 validity_period: None 2022-03-20 08:27:16 registered_delivery: RegisteredDelivery[receipt: RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED, smeOriginatedAcks: set(), intermediateNotification: False] 2022-03-20 08:27:16 replace_if_present_flag: 2022-03-20 08:27:16 data_coding: 0 2022-03-20 08:27:16 sm_default_msg_id: 0 2022-03-20 08:27:16 short_message: b'Hello' 2022-03-20 08:27:16 ] 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 RouterPB selected StaticMTRoute to smppc(SMPP_SVR) NOT RATED route for this SubmitSmPDU 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 SubmitSmPDU priority is set to 0 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 SubmitSmPDU validity_period is set to None (+b'15' minutes) 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 SubmitSmPDU registered_delivery is set to RegisteredDelivery[receipt: RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED, smeOriginatedAcks: set(), intermediateNotification: False] 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 SubmitSmBill [bid:64b9b13a-e313-4417-97ad-1ffe7d5878e1] [ttlamounts:0.0] generated for this SubmitSmPDU (x1) 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 Connector 'SMPP_SVR' is set to be a route for this SubmitSmPDU 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 SubmitSmPDU sent to [cid:SMPP_SVR], result = 99e84346-72a7-4a7e-a499-7cb6c4e28251 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 Returning {'return': '99e84346-72a7-4a7e-a499-7cb6c4e28251', 'status': 200} to 172.25.0.1. 2022-03-20 08:27:16 2022-03-20 08:27:16 INFO 1 SMS-MT [uid:app] [cid:SMPP_SVR] [msgid:99e84346-72a7-4a7e-a499-7cb6c4e28251] [prio:0] [dlr:All] [from:b'3364'] [to:b'22********'] [content:b'Hello'] 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 authenticateUser [username:app] returned a User 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 getGroup [gid:sys] returned a Group 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 getUser [uid:app] returned a User 2022-03-20 08:27:16 "172.25.0.1" - - [20/Mar/2022:08:27:15 +0000] "GET /send?username=app&password=***&dlr=yes&dlr-level=3&dlr-method=GET&dlr-url=http://dlrserver/dlr/MTDLR&from=3364&to=22********&content=Hello&validity-period=15 HTTP/1.1" 200 46 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36" 2022-03-20 08:27:16 2022-03-20 08:27:16 DEBUG 1 Executing redis command: ('EXPIRE', 'dlr:99e84346-72a7-4a7e-a499-7cb6c4e28251', 86400) 2022-03-20 08:27:17 2022-03-20 08:27:17 DEBUG 1 There is a HTTP DLR request for msgid[99e84346-72a7-4a7e-a499-7cb6c4e28251] ... 2022-03-20 08:27:17 2022-03-20 08:27:17 DEBUG 1 Got DLR information for msgid[99e84346-72a7-4a7e-a499-7cb6c4e28251], url:http://dlrserver/dlr/MTDLR, level:3, connector:SMPP_SVR 2022-03-20 08:27:17 2022-03-20 08:27:17 DEBUG 1 Publishing DLRContentForHttpapi[99e84346-72a7-4a7e-a499-7cb6c4e28251] with routing_key[dlr_thrower.http] 2022-03-20 08:27:17 2022-03-20 08:27:17 DEBUG 1 Executing redis command: ('HGETALL', 'dlr:99e84346-72a7-4a7e-a499-7cb6c4e28251') 2022-03-20 08:27:17 2022-03-20 08:27:17 DEBUG 1 Executing redis command: ('HMSET', 'queue-msgid:63C42AE0', 'msgid', '99e84346-72a7-4a7e-a499-7cb6c4e28251', 'connector_type', 'httpapi') 2022-03-20 08:27:17 2022-03-20 08:27:17 DEBUG 1 Executing redis command: ('EXPIRE', 'queue-msgid:63C42AE0', 86400) 2022-03-20 08:27:17 2022-03-20 08:27:17 DEBUG 1 Got one message (msgid:99e84346-72a7-4a7e-a499-7cb6c4e28251) to throw 2022-03-20 08:27:17 2022-03-20 08:27:17 DEBUG 1 Calling http://dlrserver/dlr/MTDLR with args {'id': '99e84346-72a7-4a7e-a499-7cb6c4e28251', 'level': 1, 'message_status': 'ESME_ROK', 'connector': 'SMPP_SVR'} using GET method. 2022-03-20 08:27:17 2022-03-20 08:27:17 INFO 1 Throwed DLR [msgid:99e84346-72a7-4a7e-a499-7cb6c4e28251] to http://dlrserver/dlr/MTDLR. 2022-03-20 08:27:17 2022-03-20 08:27:17 DEBUG 1 Mapping smpp msgid: 63C42AE0 to queue msgid: 99e84346-72a7-4a7e-a499-7cb6c4e28251, expiring in 86400 2022-03-20 08:27:17 2022-03-20 08:27:17 DEBUG 1 Destination end replied to message [msgid:99e84346-72a7-4a7e-a499-7cb6c4e28251]: 'ACK/Jasmin' 2022-03-20 08:27:24 2022-03-20 08:27:24 DEBUG 1 persistenceTimerExpired called 2022-03-20 08:27:24 2022-03-20 08:27:24 DEBUG 1 Activating persistenceTimer with 60s 2022-03-20 08:28:24 2022-03-20 08:28:24 DEBUG 1 persistenceTimerExpired called 2022-03-20 08:28:24 2022-03-20 08:28:24 DEBUG 1 Activating persistenceTimer with 60s ![image](https://user-images.githubusercontent.com/4375081/159156310-c9263f0f-492c-480a-984d-2b18e301aad7.png)
farirat commented 2 years ago

From the logs you shared i can see two submit with different "registered_delivery":

2022-03-20 08:27:16 registered_delivery: ... NO_SMSC_DELIVERY_RECEIPT_REQUESTED ... 2022-03-20 08:27:16 DEBUG 1 SubmitSmPDU registered_delivery is set to ... SMSC_DELIVERY_RECEIPT_REQUESTED ...

Which one is represented in the pcap screenshot ?

kiswend commented 2 years ago

All the logs are for the same SM. What I shared initially is an aggreated log. below are the same logs splitted by files.

messages.log

2022-03-20 08:27:16 DEBUG 1 Callbacked a submit_sm with a SubmitSmPDU[99e84346-72a7-4a7e-a499-7cb6c4e28251] (?): PDU [command: CommandId.submit_sm, sequence_number: None, command_status: CommandStatus.ESME_ROK service_type: None source_addr_ton: 'ALPHANUMERIC' source_addr_npi: 'ISDN' source_addr: b'3364' dest_addr_ton: 'INTERNATIONAL' dest_addr_npi: 'ISDN' destination_addr: b'22' esm_class: EsmClass[mode: EsmClassMode.STORE_AND_FORWARD, type: EsmClassType.DEFAULT, gsmFeatures: set()] protocol_id: None priority_flag: <PriorityFlag.LEVEL_0: 1> schedule_delivery_time: None validity_period: datetime.datetime(2022, 3, 20, 8, 42, 16, 117082) registered_delivery: RegisteredDelivery[receipt: RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED, smeOriginatedAcks: set(), intermediateNotification: False] replace_if_present_flag: 'DO_NOT_REPLACE' data_coding: 0 sm_default_msg_id: 0 short_message: b'Hello' ] 2022-03-20 08:27:16 DEBUG 1 Sending SubmitSmPDU[99e84346-72a7-4a7e-a499-7cb6c4e28251] through SMPPClientFactory [cid:SMPP_SVR] 2022-03-20 08:27:17 INFO 1 SMS-MT [cid:SMPP_SVR] [queue-msgid:99e84346-72a7-4a7e-a499-7cb6c4e28251] [smpp-msgid:b'63c42ae0'] [status:CommandStatus.ESME_ROK] [prio:0] [dlr:RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED] [val idity:none] [from:b'3364'] [to:b'22'] [content:b'Hello'] 2022-03-20 08:27:17 DEBUG 1 ACKing amqpMessage [99e84346-72a7-4a7e-a499-7cb6c4e28251] having routing_key [submit.sm.SMPP_SVR]

http-api.log

2022-03-20 08:27:16 DEBUG 1 Rendering /send response with args: {b'username': [b'app'], b'password': [b'app'], b'dlr': [b'yes'], b'dlr-level': [b'3'], b'dlr-method': [b'GET'], b'dlr-url': [b'http://usappcore:8008/pronostic/MTDLR'], b' from': [b'3364'], b'to': [b'22'], b'content': [b'Hello'], b'validity-period': [b'15']} from 172.25.0.1 2022-03-20 08:27:16 DEBUG 1 Built base SubmitSmPDU: PDU [command: CommandId.submit_sm, sequence_number: None, command_status: CommandStatus.ESME_ROK service_type: None source_addr_ton: <AddrTon.NATIONAL: 3> source_addr_npi: <AddrNpi.ISDN: 2> source_addr: b'3364' dest_addr_ton: <AddrTon.INTERNATIONAL: 2> dest_addr_npi: <AddrNpi.ISDN: 2> destination_addr: b'22' esm_class: EsmClass[mode: EsmClassMode.STORE_AND_FORWARD, type: EsmClassType.DEFAULT, gsmFeatures: set()] protocol_id: None priority_flag: <PriorityFlag.LEVEL_0: 1> schedule_delivery_time: None validity_period: None registered_delivery: RegisteredDelivery[receipt: RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED, smeOriginatedAcks: set(), intermediateNotification: False] replace_if_present_flag: <ReplaceIfPresentFlag.DO_NOT_REPLACE: 1> data_coding: 0 sm_default_msg_id: 0 short_message: b'Hello' ] 2022-03-20 08:27:16 DEBUG 1 Built Routable <jasmin.routing.Routables.RoutableSubmitSm object at 0x7f02e8223160> for SubmitSmPDU: PDU [command: CommandId.submit_sm, sequence_number: None, command_status: CommandStatus.ESME_ROK service_type: None source_addr_ton: <AddrTon.NATIONAL: 3> source_addr_npi: <AddrNpi.ISDN: 2> source_addr: b'3364' dest_addr_ton: <AddrTon.INTERNATIONAL: 2> dest_addr_npi: <AddrNpi.ISDN: 2> destination_addr: b'22' esm_class: EsmClass[mode: EsmClassMode.STORE_AND_FORWARD, type: EsmClassType.DEFAULT, gsmFeatures: set()] protocol_id: None priority_flag: <PriorityFlag.LEVEL_0: 1> schedule_delivery_time: None validity_period: None registered_delivery: RegisteredDelivery[receipt: RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED, smeOriginatedAcks: set(), intermediateNotification: False] replace_if_present_flag: <ReplaceIfPresentFlag.DO_NOT_REPLACE: 1> data_coding: 0 sm_default_msg_id: 0 short_message: b'Hello' ] 2022-03-20 08:27:16 DEBUG 1 RouterPB selected StaticMTRoute to smppc(SMPP_SVR) NOT RATED route for this SubmitSmPDU 2022-03-20 08:27:16 DEBUG 1 SubmitSmPDU priority is set to 0 2022-03-20 08:27:16 DEBUG 1 SubmitSmPDU validity_period is set to None (+b'15' minutes) 2022-03-20 08:27:16 DEBUG 1 SubmitSmPDU registered_delivery is set to RegisteredDelivery[receipt: RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED, smeOriginatedAcks: set(), intermediateNotification: False] 2022-03-20 08:27:16 DEBUG 1 SubmitSmBill [bid:64b9b13a-e313-4417-97ad-1ffe7d5878e1] [ttlamounts:0.0] generated for this SubmitSmPDU (x1) 2022-03-20 08:27:16 DEBUG 1 Connector 'SMPP_SVR' is set to be a route for this SubmitSmPDU 2022-03-20 08:27:16 DEBUG 1 SubmitSmPDU sent to [cid:SMPP_SVR], result = 99e84346-72a7-4a7e-a499-7cb6c4e28251 2022-03-20 08:27:16 DEBUG 1 Returning {'return': '99e84346-72a7-4a7e-a499-7cb6c4e28251', 'status': 200} to 172.25.0.1. 2022-03-20 08:27:16 INFO 1 SMS-MT [uid:app] [cid:SMPP_SVR] [msgid:99e84346-72a7-4a7e-a499-7cb6c4e28251] [prio:0] [dlr:All] [from:b'3364'] [to:b'22'] [content:b'Hello']

farirat commented 2 years ago

Since you have [dlr:RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED] then the submit were sent with that flag on. Are you receiving the deliver_sm holding the dlr ? and what was jasmin's reaction in dlr logs ?

kiswend commented 2 years ago

Thanks for your reply.

As per the screenshot I shared, only the SMSC delivery receipt was sent. I'm indeed receiving the DLR confirming the SMSC received my SMS. this part is working as expected.

But the DLR for the SME was not requested in the PDU. The bits 3 and 2 of the PDU's registered_delivery are both 0. So we won't know if the end user actually received the SM or not.

As per my underding setting the dlr-level to 3 in the URL will request both SMSC and SME DLRs. So for a successful SMS MT we should receive two DLR (depending of the SMSC configuration)

we may discuss on skype https://join.skype.com/invite/dXUvjIjRbNiT

github-actions[bot] commented 5 months ago

Stale issue detected, remove stale label or comment or this will be closed soon.

github-actions[bot] commented 4 months ago

This issue was closed because it has been stalled more than a year with no activity.