jberkel / sms-backup-plus

Backup Android SMS, MMS and call log to Gmail / Gcal / IMAP
https://play.google.com/store/apps/details?id=com.zegoggles.smssync
Apache License 2.0
1.79k stars 497 forks source link

Improvement: backup (and restore) "date_sent" #1036

Closed mcg-android closed 3 years ago

mcg-android commented 3 years ago

Using SMS Backup+ version 1.5.11 (1576) installed from F-Droid, I can observe that the RFC822-style backup messages contain the "date" field of table "sms" from Android's "mmssms.db", but do not contain the "date_sent" field (which holds the remote side's timestamp, i.e. the time an incoming SMS message was sent and the time an outgoing SMS message was delivered).

Would it be possible to also backup (and restore) "date_sent"?

kurahaupo commented 3 years ago

This seems like a good point.

RFC-822 say that the Date: field should be filled in by the sending agent, which means it's the time the message was sent.

That means that in the outgoing case Date: is correct, but in the incoming case it should ideally be adjusted.

It may be useful to include an X-Delivery-Date: header or even a synthesised Received: header to record the delivery date.

It's not clear that the "remote side's timestamp" would actually tell you when it's been delivered to the correspondent's CPE, as SMS is store-and-forward (same as email), and even if you request a delivery receipt, tying that back to the saved sent message is unreliable as it typically only identifies the recipient number, not a particular message. Rather, I would expect it would indicate when the SMS is "accepted" by the network rather than "delivered" to the terminal device.

kurahaupo commented 3 years ago

Closing as a duplicate of #1032

mcg-android commented 3 years ago

It may be useful to include an X-Delivery-Date: header or even a synthesised Received: header to record the delivery date.

+1 :+1:

mcg-android commented 3 years ago

... I would expect it would indicate when the SMS is "accepted" by the network rather than "delivered" to the terminal device.

Unable to quote a standard, but based on 20+ years of observation: I am very sure the delivery timestamp returned to the sender is the point in time the message got passed to the mobile (which typically would have been offline (i.e. switched off or outside coverage) until then).

kurahaupo commented 3 years ago

Maybe it would be clearer to describe it as the "hand off" timestamp; in most cases you simply don't get a true delivery timestamp at all.

Unless the sending device is configured to request SMS delivery receipts, there's no notification at all when a message is delivered to the recipient device, let alone read.

And even if the device does ask for a delivery receipt, without a unique message identifier it cannot tell for certain which sent message it's referring to.

I've never seen a phone that came with "request SMS delivery receipts" turned on out-off-the-box. And there's no guarantee that telcos will even honour the request if you turn it on.

All that said, it's been a long time since I worked in a telco, so I may have forgotten or overlooked something; if you can point me in the direction of relevant documentation that would be appreciated.