I am using EC200U with STM32. I send an OTP request to a server via UDP using EC200U. After sending the request, I pause the STM32 (breakpoint), remove the SIM from EC200U, and insert it into a mobile — but no OTP arrives in the mobile.
However, if the SIM is already in the mobile before sending the request, the OTP arrives correctly.
Your understanding is correct. Once the network successfully delivers an SMS to the registered device (in this case, your EC200U module), the SMS Service Center (SMSC) considers the transaction complete and will not retry delivery to another device just because the SIM has been moved.
For the OTP to be visible on your mobile phone after swapping the SIM, it must have been fully received and successfully written to the SIM card’s message storage area by the EC200U before removal
Please refer below for answers to your question:
Does EC200U “claim” the SMS at the network level as soon as it is delivered?
Yes. Because the EC200U is registered on the network with that SIM’s IMSI, the network targets that specific hardware for delivery. As soon as the module acknowledges the receipt of the SMS to the network, the SMSC stops any further delivery attempts for that specific message
Even with CNMI=2,1, is the SMS guaranteed to be stored in SIM before removal?
No, it is not guaranteed if the SIM is removed too quickly. When you use AT+CNMI=2,1 , the module is configured to send a +CMTI: “SM”, unsolicited result code (URC) only after the message has been successfully stored in the SIM
Is this behavior due to SMS class (e.g., Class-0/Flash SMS) or network policy?
Your command AT+CSMP=17,167,0,241 sets the Data Coding Scheme (DCS) to 241 (which is 0xF1 in hex). According to 3GPP specifications, this indicates a Class 1 SMS.
Class 1 messages are intended to be stored in the memory of the device or the SIM
Is there any modem setting that allows the same OTP to be readable in mobile after SIM swap?
Your current settings are correct for targeting the SIM:
AT+CPMS=“SM”,“SM”,“SM” correctly sets the preferred storage to the SIM card.
AT+CNMI=2,1 correctly configures the module to notify you once storage is complete