the UICC code / ICCID is also available with this on scripts, but must be already present on winbox for be readed:
:put ([/interface lte info lte1 once as-value]->“uicc”):put ([/interface lte monitor lte1 once as-value]->“uicc”)
The LTE Model R11e-4G Revision R11e-4G_V007 actually support the read of ICCID value, but RouterOS do not use correct AT command and do not obtain the value
output: +CME ERROR: operation not supportedFor this reason is unavailable also inside winbox
But you can obtain it with this command:
/int lte at-chat lte1 input=“AT%CCID”
output: +ICCID: 8548512350010720871
Both:
Generally speaking the the OP’s command “AT+CCID” is right – but not all modules follow the “standard” here. Telit/Sierra generally use AT+ICCID, wasn’t sure if that help with R11e…
But “AT%CCID” be for WNC-based R11e LTE modems while some R11e LTE modems may use the Quectel version “AT+QCCID”…
But the OP mention a PIN code being set… I’m really not sure if you should even be able to read the ICCID without the PIN code – although that doesn’t make sense since the ICCID is printed on the SIM card & the ICCID is NOT a security key itself.
Which is why for V6,
:put ([/interface lte info [find running] once as-value]->"uicc")
or, for V7,
:put ([/interface lte monitor [find running] once as-value]->"uicc")
NOTE: “monitor” vs “info”
Using the monitor/info is WAY better than messing with at-chat since it really depending on the module/firmware/etc what work…
And, depending on modem module model/fireware/ROS version/etc…, you may not also be able to use at-chat if the modem isn’t up either…
I say this since AT may be sent via MBIM, so there is no “real” AT channel & without an MBIM session being established, in some form, at-chat may not won’t work either. Now if the modem is ECM modem, again you may see different behavior since there should be some “real” USB serial port for ROS to use.
NOTE: On this particular board I’ve already setup the pin, but I need to read the ICCID BEFORE setting the ping (I’m working on a sort of automated deploy script)
/int lte at-chat lte1 input="AT*ICCID\?"
output: *ICCID: 893988084511168xxx
OK
Now, since I’ve a bounch of different devices I think I’ll have to find the right command for every modem/firmware I’ve got and write a script that tries to run every command until it find the working one.
Don’t know if this helps anyone, I did write a quick script function, findiccids, to search all the possibilities of separators ("+ ! @ # % $ *) between AT and “ICCID” or “CCID”.
:global findiccids do={
:local atstrs {"ICCID";"CCID"}
:local atseps {"+";"!";"@";"#";"%";"\$";"*"}
:local rv
:local result
:foreach cmd in=$atstrs do={
:foreach sep in=$atseps do={
:foreach lteif in=[find running] do={
:local ltename [/interface lte get $lteif name]
:put "Trying 'AT$sep$cmd' on $ltename"
:set result [/interface lte at-chat $lteif input="AT$sep$cmd" as-value]
:if (result~".*[0-9]{12,16}.*") do={
# todo: should parse out the ICCID...
:put "Found ICCID using 'AT$sep$cmd' on $ltename: $($result->"output")"
}
}
}
}
:return rv
}
$findiccids
which outputs:
> $findiccids
Trying 'AT+ICCID' on lte1
Found ICCID using 'AT+ICCID' on lte1: ICCID: 890141032791yyyyxxxx
OK
Trying 'AT!ICCID' on lte1
Trying 'AT@ICCID' on lte1
Trying 'AT#ICCID' on lte1
Trying 'AT%ICCID' on lte1
Trying 'AT$ICCID' on lte1
Trying 'AT*ICCID' on lte1
Trying 'AT+CCID' on lte1
Trying 'AT!CCID' on lte1
Trying 'AT@CCID' on lte1
Trying 'AT#CCID' on lte1
Trying 'AT%CCID' on lte1
Trying 'AT$CCID' on lte1
Trying 'AT*CCID' on lte1