Carrier Info via API

Is it possible to get the carrier info over the Talk2M API?

  • ICCID
  • Carrier
  • APN
  • Phone Number

It’s not possible to retrieve the phone number, but all three other values are accessible, though not directly. ICCID and carrier are both included in the estat.htm, while the APN can be retrieved from comcfg.txt. You can retrieve these files through the M2Web API by requesting an Export Block Descriptor, then extracting the right parameters out of the file it returns.

In estat.htm, the parameters are:

  • GsmOpName (carrier)
  • GsmCCID (ICCID)

In comcfg.txt, the parameter is:

  • PdpApn (APN)

If you have a Flexy, probably the cleanest way to do this would be to set up some Basic code on the Ewon that loads the values you want into a few tags, then use the M2Web API to request the values of those tags. If you have string tags named Carrier, ICCID, and APN, here’s what that could look like:

REM Set a timer to load cellular values every 10 seconds
TSET 1, 10
ONTIMER 1, "GOTO LoadCellVals"
END

LoadCellVals:
  REM Get values from estat
  SETSYS INF, "load"
  Carrier@ = GETSYS INF, "GsmOpName"
  ICCID@ = GETSYS INF, "GsmCCID"
  REM Get value from comcfg
  SETSYS COM, "load"
  APN@ = GETSYS COM, "PdpApn"
END
1 Like