This seems like an issue in Modem Manager API design issue. ofono and fsmgsd does it correctly.
A fix would be “either introduce some persistent storage of chunks, or design and API that lets an external process handle and acknowledge CSM as they arrive without buffering on SIM.”
My child’s teacher sent me two messages today (or maybe just one, I don’t know) and I don’t know what she wrote.
On the first message, the phone was suspended and I saw the message woke it up (screen turned on, wifi connected a few seconds later; no visible notification, but I saw the dreaded (receiving) when I ran mmcli).
However I just made a test by suspending the phone (using the menu from the “power” icon) and sending a message from my wife’s phone, and that time it worked fine. Maybe it’s non-deterministic, or maybe it depends who sends the message..?
By the way it seems very much related to which provider you have. I’ve been having these stuck SMS problems ever since I changed to another provider. With the previous one it’s always been fine.
SMS is not a reliable protocol, messages can get lost just because the infrastructure had a bad mood that day. That’s the first thing to have in mind.
Second thing is that an SMS is limited to 160 characters (or less, depending on encoding). If you send a longer message, it gets split into several parts.
Third thing is that ModemManager does not expose a message to lower layers until it receives all of its parts. Until that happens, it’s seen as “receiving”.
Forth thing is that ModemManager relies on SIM storage to retrieve incoming messages. Lower layers, such as Chatty, grab a complete message from there and delete it from the SIM after processing. This doesn’t happen with “receiving” messages, as these are still waiting for some of their parts to be delivered. This also means that if the SIM storage is full, you can’t receive more messages until you make some room for them.
Combine it all together and you’ll have a pretty good mental model of the issues you’re seeing.
Oh, and one more thing - with SMS, due to various hiccups, the sender may get a network error even though the message has been actually sent and retry sending a message that was already sent. The network may also deliver multiple copies of a message that was sent only once.
If this happens to a multi-part message, you may end up correctly receiving and processing the whole message first, and then receiving a duplicate part of it which will now be stuck as “receiving” as it will be missing the rest of the parts forever.
You can still read the contents of the stuck parts that are stored on the SIM, but you need to use either AT or QMI commands directly as IIRC the MM API does not provide a way to access that.
Incoming MMS is signaled using an SMS, so there’s nothing surprising in that.
Oh that’s interesting, I’ll investigate about that. Indeed I didn’t see anything in mmcli to retrieve message text. Just metadata with sender number and timestamp.
There was a time when SIMs have provided plenty of space for messages, but as most phones haven’t relied on SIM space for many years now, these days it’s not uncommon for SIMs to only provide 20 message slots as they used to long time ago (I wouldn’t be surprised if that’s the minimum amount required by the standard).
Sixth thing is: The sender (assumed not to be a Librem 5) may decide to use MMS rather than SMS based on the attributes of what it wants to send, including, in my experience, not so far listed here, depending on the number of recipients i.e. one sender sending to one recipient may differ in behaviour as compared with one sender sending to multiple recipients.
Encryption often makes a message longer - because of a) pure ASCII then becomes opaque octets that may then need encoding to bring it back to pure ASCII or otherwise is longer b) padding c) other features of the encryption algorithm that are necessary to achieve robustness against various attacks - so a message that starts out under the 160 byte limit may no longer be under the limit, and
Is there a standard to conform to or is every SMS client going off in its own direction with an incompatible implementation? or is the chosen standard included in the message that then contributes to the previous bullet point?
But sure if you have a single pair of cooperating parties who have already exchanged key material securely outside of SMS and have agreed on what implementation to use and you don’t mind significant inconvenience … you can encrypt outside of $Chatty and then paste in and then send … and the receiver copies out and then decrypts outside of $Chatty and that will work - and I put a dollar sign in front of Chatty because the same works just fine with any messaging implementation (which is just being used as an insecure transport).
Yes I repeated the experiment a couple of times. All multi-part messages sent while the phone is awake were successfully received. All multi-part messages sent while the phone is sleeping were lost.
As an additional experiment I sent a multi-part message while the phone was off, the message was received correctly as soon as I turned it on and entered the sim pin.
So for now I’ll disable suspend, hopefully I won’t lose any more messages now.
Yes I’ll do that when I have both time, and access to my wife’s phone for sending test messages . Is Librem5/debs/ModemManager the correct project for reporting the issue?