How To determine Whether a Device Contains a Super SIM
Every customer must set the Access Point Name (APN) that an IoT device’s cellular modem will use for Internet connectivity. If all of their devices contain Super SIMs, this is straightforward: use the APN super
.
However, if your products contain SIMs from a variety of suppliers, including Twilio, you will first need to check which SIM a given device contains so that you can set the appropriate APN for that SIM. Typically, to detect SIM type you read back the SIM’s IMSI.
However, one the key advantages of Super SIM is that it includes multiple IMSIs to enable switching between different local networks in the territory in which the host device is operating. This means that you should not use an IMSI to determine whether a given device contains a Super SIM.
Instead, issue the AT+CRSM
command with the following parameters to retrieve the SIM’s Service Provider Name (SPN):
AT+CRSM=176,28486,0,0,17
If the device’s SIM is a Super SIM, this command will return:
+CRSM: 144,0,"005477696C696FFFFFFFFFFFFFFFFFFFFF"
The third, textual field provides the SPN. Each pair of characters is a hexadecimal character code. To extract the SPN, ignore the first pair of characters (00
) and read up to the first FF
. Now convert each hex pair to an Ascii character:
Hex | Ascii |
---|---|
54 |
T |
77 |
w |
69 |
i |
6C |
l |
69 |
i |
6F |
o |
You can shortcut this process simply by comparing the third field to 005477696C696FFFFFFFFFFFFFFFFFFFFF
. If the strings match, your code knows it is using a Super SIM and can issue the APN super
.
If you’d like to learn more about the fields included in the initial AT+CSRM
command and how the response is formatted, check out section 4.2.12 of the ETSI UMTS Specification. For example, the 176
in the command indicates a binary read command; the 28486
indicates that we want to receive the SPN.
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.