Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP API - No Delivery Report where SMS has more than one segment even with dlr=yes #1136

Open
Herneto opened this issue Oct 15, 2023 · 4 comments

Comments

@Herneto
Copy link

Herneto commented Oct 15, 2023

Hello all,

I am seing a strange behavior in Jasmin HTTP API when requesting dlr in SMS with more than one segment.

Case 1:

- My app log - SMS with more than 153 caracteres coding=0 and dlr=yes:

INFO -- request: GET http://myhost.click:1401/send?coding=0&dlr=yes&dlr-level=3&dlr-method=GET&dlr-url=https%3A%2F%2F872f-154-118-211-22.ngrok-free.app%2Fv1%2Fdlr&from=TESTE&hex-content=464546463030353130303735303036353030373230464546463030353130304645464630303531303037353030363530303732304645464630303531303046454646303035313030373530303635303037323046454646303035313030464546463030353130303735303036353030373230464546463030353130304645464630303531303037353030363530303732304645464630303531464546463030353130303735303036353030373230464546463030353130304645464630303531303037353030363530303732304645464630303531303046454646303035313030373530303635303037323046454646303035313030464546463030353130303735303036353030373230464546463030353130304645464630303531303037353030363530303732304645464630303531&password=plugin&to=922939415&username=user40

- jasmin log (messages.log)

2023-10-15 10:28:40 INFO 1 SMS-MT [cid:site1] [queue-msgid:08af7ad0-fe93-4bf6-86ea-c37a59a7adb1] [smpp-msgid:b'4E2CBDA5'] [status:CommandStatus.ESME_ROK] [prio:0] [dlr:RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED] [validity:none] [from:b'TESTE'] [to:b'922939415'] [content:b'FEFF00510075006500720FEFF005100FEFF00510075006500720FEFF005100FEFF00510075006500720FEFF005100FEFF00510075006500720FEFF005100FEFF00510075006500720FEFF0051FEFF00510075006500720FEFF005100FEFF00510075006500720FEFF005100FEFF00510075006500720FEFF005100FEFF00510075006500720FEFF005100FEFF00510075006500720FEFF0051']
2023-10-15 10:28:43 INFO 1 DLR [cid:site1] [smpp-msgid:4E2CBDA5] [status:DELIVRD] [submit date:2310151128] [done date:2310151128] [sub/dlvrd messages:001/001] [err:000] [content:'FEFF0051007500650072']

Case 2:

- My app log - SMS with 153 caracteres coding=0 and dlr=yes:

INFO -- request: GET http://myhost.click:1401/send?coding=0&dlr=yes&dlr-level=3&dlr-method=GET&dlr-url=https%3A%2F%2F872f-11154-122218-211-22.ngrok-free.app%2Fv1%2Fdlr&from=TESTE&hex-content=464546463030353130303735303036353030373230464546463030353130304645464630303531303037353030363530303732304645464630303531303046454646303035313030373530303635303037323046454646303035313030464546463030353130303735303036353030373230464546463030353130304645464630303531303037353030363530303732304645464630303531&password=plugin&to=922939415&username=user40

- jasmin log (messages.log)

2023-10-15 10:29:06 INFO 1 SMS-MT [cid:unitel1] [queue-msgid:1f05fe2c-1db8-45e0-b468-fe47c4f06ee6] [smpp-msgid:b'4E2E4412'] [status:CommandStatus.ESME_ROK] [prio:0] [dlr:RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED] [validity:none] [from:b'TESTE'] [to:b'922939415'] [content:b'FEFF00510075006500720FEFF005100FEFF00510075006500720FEFF005100FEFF00510075006500720FEFF005100FEFF00510075006500720FEFF005100FEFF00510075006500720FEFF0051']
2023-10-15 10:29:07 INFO 1 DLR [cid:unitel1] [smpp-msgid:4E2E4412] [status:DELIVRD] [submit date:2310151129] [done date:2310151129] [sub/dlvrd messages:001/001] [err:000] [content:'FEFF0051007500650072']

In both cases I am requesting the deliver report (dlr=yes), but in Case 1, as shown above, the dlr is being setted as NO_SMSC_DELIVERY_RECEIPT_REQUESTED.

What does xplain this behavior? I read the documentation and couldn't find any reason.

Thank you

EDIT:

I found on issue 789 that in mult-part sms, jasmin only request the dlr for the last part.

It is seams that my carrier is actually sending the dlr for the last part but Jasmin is not being able to match last part message dlr with the whole message, on the logs, everytime I send a multi-part SMS, I get this:

2023-10-15 11:03:52 ERROR 1 [msgid:4E3F73DD] (retrials: 1/2) DLRMapNotFound: Got a DLR for an unknown message id: 4E3F73DD (coded:4E3F73DD)
2023-10-15 11:04:02 ERROR 1 [msgid:4E3F73DD] (final) DLRMapNotFound: Got a DLR for an unknown message id: 4E3F73DD (coded:4E3F73DD)

@Kisuke-CZE
Copy link
Contributor

Not sure if this will be helpful. But for me it works.

As for the SMSC_DELIVERY_RECEIPT_REQUESTED only on last part. I actually tried 2 commercial alternatives for sending messages, and they do it same way. If DLR is requested by the client, DLR is requested only on last part of message. So I believe it's some "industry standard".

But back to your problem. Which I surprisingly do not have. Here are some observations from wireshark.

If client sends a message, it generates in messages.log:

2023-10-20 18:34:43 INFO     2965351 SMS-MT [cid:SMSCPROTO] [queue-msgid:4355522a-b05d-441e-b385-4b22d014137e] [smpp-msgid:b'238668549'] [status:CommandStatus.ESME_ROK] [prio:0] [dlr:RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED] [validity:none] [from:b'TESTING'] [to:b'420123456789'] [content:b"Hello world! There is some very long text message sent through jasmin sms which will cause message is splitted in multiple PDUs. Let's see how the DLR will be handled"]

Sending first part looks like this in wireshark:
first_part

The second has a DLR request as expected:
second_part

And then DLR comes in:
DRL_received

Which triggers this in my dlr-thrower.log (but I do not have direct connectivity back to http client, so error is expected):

2023-10-20 18:38:17 ERROR    2965353 Throwing HTTP/DLR [msgid:4355522a-b05d-441e-b385-4b22d014137e] to (http://smpp-testing.example.com/plugin/gateway/jasmin/callback.php): ConnectingCancelledError(HostnameAddress(hostname=b'smpp-testing.example.com', port=80),).

And also in dlrlookupd-messages.log:

2023-10-20 18:34:47 INFO     2965352 DLR [cid:SMSCPROTO] [smpp-msgid:238668549] [status:DELIVRD] [submit date:2310201834] [done date:2310201834] [sub/dlvrd messages:001/001] [err:000] [content:'14050003050202D86C90']

@amarwk94
Copy link

I have edited jasmin/protocols/http/endpoints/send.py, search for the following line:

_last_pdu.params['registered_delivery'] = RegisteredDelivery(
RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED)

Replace it with:

_last_pdu.params['registered_delivery'] = RegisteredDelivery(
RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED)

@Kisuke-CZE
Copy link
Contributor

I tried to fix the logging part in commit above. Those logs are really misleading if someone investigates them.
Seems there are multiple problems with multipart messages. But let's try to make jasmin little bit better SW.

@hartois
Copy link

hartois commented Apr 28, 2024

See #1190 and PR linked to it.
Maybe it's your case...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants