Long latency when receiving SMs on FX30

I am using a sample app to send/receive messages but I have noticed that there is a long latency with the handler when receiving SMS and I am trying to understand if this is due to the network, signal or the app itself.

This is the radio signal for the SIM:
root@fx30s:~# cm radio
Power: ON
Current Network Operator: Telstra Mobile
Current RAT: LTE network (LE_MRC_RAT_LTE)
Status: Registered, home network (LE_MRC_REG_HOME)
Signal: Strong signal strength (4)
PS: Packet Switched Registered, home network (LE_MRC_REG_HOME)

On bootup it will get the SMS, but after the unit is running for a while it will take a long time to receive the messages, I have noticed up to 10 minutes to get them.

the handler from the sample code is just not getting invoked

static void RxMessageHandler
(
le_sms_MsgRef_t msgRef,
void* contextPtr
)
{
le_result_t res;
char tel[LE_MDMDEFS_PHONE_NUM_MAX_BYTES];
char timestamp[LE_SMS_TIMESTAMP_MAX_BYTES] = {0};
char text[LE_SMS_TEXT_MAX_BYTES] = {0};

LE_INFO("New message received.");

/do stuff/

    res = le_sms_DeleteFromStorage(msgRef);
    if(res != LE_OK)
    {
        LE_ERROR("le_sms_DeleteFromStorage has failed (res.%d)!", res);
    }
    else
    {
        LE_INFO("the message has been successfully deleted from storage.");
    }
}
else
{
    LE_WARN("Warning! I read only Text messages!");
}

le_sms_Delete(msgRef);
LE_INFO("message object deleted from memory.");

}

and I am having an hard time to understand if this is due to the app or there are some settings I can change for the le_sms (couldn`t find any from the le_sms API) which will make this more responsive.
Is this just a matter of the modem polling the SMS server for new messages?

May 4 09:53:02 fx30s user.info Legato: INFO | modemDaemon[1215]/le_pa T=main | pa_mrc_qmi.c pa_mrc_GetNetworkRegState() 2332 | called
May 4 09:53:02 fx30s user.info Legato: INFO | modemDaemon[1215]/le_pa T=main | pa_mrc_qmi.c pa_mrc_GetNetworkRegState() 2332 | called
May 4 09:53:02 fx30s user.err Legato: =ERR= | modemDaemon[1215]/modemDaemon T=main | le_sms.c CloseSessionEventHandler() 2181 | SessionRef (0x7f61c4d4) has been closed
May 4 09:53:12 fx30s user.info Legato: INFO | modemDaemon[1215]/le_pa T=main | pa_mrc_qmi.c pa_mrc_GetNetworkRegState() 2332 | called
May 4 09:53:12 fx30s user.info Legato: INFO | modemDaemon[1215]/le_pa T=main | pa_mrc_qmi.c pa_mrc_GetNetworkRegState() 2332 | called
May 4 09:53:12 fx30s user.err Legato: =ERR= | modemDaemon[1215]/modemDaemon T=main | le_sms.c CloseSessionEventHandler() 2181 | SessionRef (0x7f61c7fc) has been closed
May 4 09:53:41 fx30s user.err kernel: [ 607.942197] disconnect_to_bam: shutdown completion time was: 5000 msec
May 4 09:53:43 fx30s user.err Legato: =ERR= | modemDaemon[1215]/modemDaemon T=main | le_sms.c CloseSessionEventHandler() 2181 | SessionRef (0x7f61c4d4) has been closed
May 4 09:53:45 fx30s user.info Legato: INFO | modemDaemon[1215]/le_pa T=main | pa_mrc_qmi.c pa_mrc_GetNetworkRegState() 2332 | called
May 4 09:53:45 fx30s user.info Legato: INFO | modemDaemon[1215]/le_pa T=main | pa_mrc_qmi.c pa_mrc_GetNetworkRegState() 2332 | called
May 4 09:53:45 fx30s user.err Legato: =ERR= | modemDaemon[1215]/modemDaemon T=main | le_sms.c CloseSessionEventHandler() 2181 | SessionRef (0x7f61c7fc) has been closed
May 4 09:53:49 fx30s user.info Legato: INFO | modemDaemon[1215]/le_pa T=main | pa_mrc_qmi.c pa_mrc_GetNetworkRegState() 2332 | called
May 4 09:53:49 fx30s user.info Legato: INFO | modemDaemon[1215]/le_pa T=main | pa_mrc_qmi.c pa_mrc_GetNetworkRegState() 2332 | called
May 4 09:53:49 fx30s user.err Legato: =ERR= | modemDaemon[1215]/modemDaemon T=main | le_sms.c CloseSessionEventHandler() 2181 | SessionRef (0x7f61c4d4) has been closed

These are the errors which I see from the logs when I am sending an SMS and the handler is not getting invoked.

you can try on AT command port first to isolate if this is related to network or application

how do you send messages to the AT port?

you can see here:

I don`t have problems on sending messages out, but only on receiving messages.

then did you see the SMS receive indication?

it seems that the AT port will behave as the Handler itself, so to say, as soon as the +CMTI: “ME”,XX is displayed then the message handler will be invoked.

root@fx30s:~# microcom /dev/ttyAT

+CMTI: “ME”,40

+CMTI: “ME”,41

+CMTI: “ME”,40

+CMTI: “ME”,41

+CMTI: “ME”,40

+CMTI: “ME”,41

+CMTI: “ME”,40

+CMTI: “ME”,41

+CMTI: “ME”,40

but sometimes after a send a SMS from my phone, it will take a fair bit before the the message is shown and the handler is invoked.

then maybe network operator problem…

This is what happens:

  1. using phone number 1 to send messages, at a given point the modem will stop receiving messages

  2. then I use phone number 2 and the message will be received immediately, also the messages sent from phone number 1 will be received. After a couple of messages, SMS from this number will not be received anymore.

  3. using phone number 3 will have the same effect, SMS immediately received and also the SMS sent from phone numbers 1 and 2 will be received.

It may be related with the server side, but if I use the same SIM card in a normal phone, then all SMS will be received immediately so I am wondering if there is a polling problem related with the le_sms API?

in this case, might need to check with operator.
Or you can do some more test with different operator to get more clue.

checking with operator about what exactly?

to check if the SMS has been sent out from base station during the latency

it does work when the SIM is in a cell phone, so the problem is not the SMS not being sent from the operator.

You can try to send sms to itself and see if there is delay