# Detecting SMS service status

**URL:** https://forum.sierrawireless.com/t/detecting-sms-service-status/4343
**Category:** Open AT
**Created:** [April 7, 2010, 9:38am UTC](https://forum.sierrawireless.com/t/detecting-sms-service-status/4343 "2010-04-07T09:38:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![JohnnySoft](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@JohnnySoft](https://forum.sierrawireless.com/u/JohnnySoft)
#### Post date: [April 7, 2010, 9:38am UTC](https://forum.sierrawireless.com/t/detecting-sms-service-status/4343/1 "2010-04-07T09:38:33Z")

</div>

Does anyone know if there is a way to verify that the SMS service is available - ideally before trying to send an SMS and getting an error code? Presumably theres an AT command to query the status of the modem, but where do I start looking ?

Basically I want my app to be able to recognise and reject a duff SIM card at start up. I check the initialisation state of the SIM but that always returns OK even with a bad SIM. Presumably that just means that the SIM data has been read out OK.

---

<div class="post-metadata">

### Author: ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)
#### Post date: [April 7, 2010, 10:24am UTC](https://forum.sierrawireless.com/t/detecting-sms-service-status/4343/2 "2010-04-07T10:24:23Z")

</div>

> [@JohnnySoft](#):
>
> Does anyone know if there is a way to verify that the SMS service is available

There is no specific way to check for SMS service.

You can check GSM registration with AT+CREG and/or monitor +CREG: and/or +WIND: unsolicited responses - clearly, you can’t do anything network-realted when you’re not registered to the network!

[forum.sierrawireless.com/viewtop … =15#p17708](http://forum.sierrawireless.com/viewtopic.php?f=7&t=3766&hilit=faq+wiki&start=15#p17708)

You could also check that AT+CSCA does not give “error”.

> [@](#):
>
> ideally before trying to send an SMS and getting an error code?

When you do get an error code, be sure to check it to see if it indicates a network problem!

> [@](#):
>
> Presumably theres an AT command to query the status of the modem, but where do I start looking ?

Why, the AT Commands Manual, of course! 8)

> [@](#):
>
> I check the initialisation state of the SIM

How, exactly, do you check that?

> [@](#):
>
> but that always returns OK even with a bad SIM.

What, precisely, do you mean by a “bad” SIM here?

---

<div class="post-metadata">

### Author: ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)
#### Post date: [April 7, 2010, 10:35am UTC](https://forum.sierrawireless.com/t/detecting-sms-service-status/4343/3 "2010-04-07T10:35:08Z")

</div>

> [@awneil](#):
>
> monitor +CREG: and/or +WIND: unsolicited responses

Note that +WIND: 16 is documented as,

> [@](#):
>
> SMS and SMS CB services are initialized

This refers only to internal initialisations within the modem - you also have to wait for network registration.

---

<div class="post-metadata">

### Author: ![JohnnySoft](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@JohnnySoft](https://forum.sierrawireless.com/u/JohnnySoft)
#### Post date: [April 14, 2010, 11:08am UTC](https://forum.sierrawireless.com/t/detecting-sms-service-status/4343/4 "2010-04-14T11:08:34Z")

</div>

Thanks again awneil, very helpful as always. The bad SIM I referred to was such that the modem was unable to register on the network and my software didn’t detect that. I got the SIM initialisation status OK, but I think that just means that OpenAT has managed to read the SIM data.

In the end I used the response to the CREG command to determine network status. More useful to my app and not necessarily just to do with the SIM really, could be a variety of reasons.

Thanks.

---

<div class="post-metadata">

### Author: ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)
#### Post date: [April 14, 2010, 1:13pm UTC](https://forum.sierrawireless.com/t/detecting-sms-service-status/4343/5 "2010-04-14T13:13:04Z")

</div>

> [@JohnnySoft](#):
>
> I got the SIM initialisation status OK, but I think that just means that OpenAT has managed to read the SIM data.

Correct.

SIM initialisation is necessary, but not sufficient.

> [@](#):
>
> In the end I used the response to the CREG command to determine network status.

CREG state = 1 or 5 is necessary and sufficient.
