Community discussions

MikroTik App
 
ceres
just joined
Topic Author
Posts: 13
Joined: Fri Nov 05, 2010 7:18 pm

LTE SIM info

Tue Apr 05, 2022 12:56 pm

Hi,
I need to get the SIM serial number before setting the pin.

Right now I'm only successed to retrieve the uicc using this command:
:put ([ / interface lte info [ :pick [ find ] 0 ] once as-value ]->"uicc")
But this only works after setting the PIN.

I've tried with AT commands but I've got a strange behaviour:
/interface lte at-chat 0 input="AT+CCID"                                  
  output: ERROR
This happens both with or without pin number set.

Any idea?
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: LTE SIM info

Tue Apr 05, 2022 5:00 pm

Never tried with a SIM with pin set, so don't know for sure the behavior. But your at-chat AT command might be "AT+ICCID", not just AT+CCID.
/interface lte at-chat [find running] input="AT+ICCID" 
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: LTE SIM info

Tue Apr 05, 2022 7:51 pm

output: +CME ERROR: 4
(Operation not supported)
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: LTE SIM info

Tue Apr 05, 2022 9:09 pm

This is valid for ROS 6.48.6, with LTE Model "R11e-LTE" Revision "MikroTik_CP_2.160.000_v020"

v6 code

/interface lte at-chat lte1 input="AT+ICCID\?" 
  output: +ICCID: 8548512350010720871f

v7 code

/interface lte at-chat lte1 input="AT+ICCID?" 
  output: +ICCID: 8548512350010720871f

Both:
:put [:pick ([/interface lte at-chat lte1 input="AT+ICCID\?" as-value]->"output") 8 27]
8548512350010720871
EDIT: added Model and Revision of LTE modem used.
Last edited by rextended on Tue Apr 05, 2022 9:35 pm, edited 2 times in total.
 
holvoetn
Forum Guru
Forum Guru
Posts: 5320
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: LTE SIM info

Tue Apr 05, 2022 9:27 pm

SXT LTE on 7.2rc7
[xyz@MTSXTLte] > :put [:pick ([/interface lte at-chat lte1 input="AT+ICCID\?" as-value]->"output") 8 27]

<blank, nothing returned>

[xyz@MTSXTLte] > /interface lte at-chat lte1 input="AT+ICCID?"
  output: ERROR

FYI: firmware on that thing was upgraded past weekend to V033
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: LTE SIM info

Tue Apr 05, 2022 9:33 pm

Uh, sorry, I forget the LTE Modem version,
I edit the previous post,
Provide same detail I add
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: LTE SIM info

Tue Apr 05, 2022 9:38 pm

I find the way, read
viewtopic.php?p=924221#p924221
Last edited by rextended on Tue Apr 05, 2022 10:22 pm, edited 2 times in total.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: LTE SIM info

Tue Apr 05, 2022 9:43 pm

the UICC code / ICCID is also available with this on scripts, but must be already present on winbox for be readed:

v6 code

:put ([/interface lte info lte1 once as-value]->"uicc")

v7 code

:put ([/interface lte monitor lte1 once as-value]->"uicc")
Last edited by rextended on Tue Apr 05, 2022 11:08 pm, edited 1 time in total.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: LTE SIM info

Tue Apr 05, 2022 10:20 pm

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

AT+ICCID code

output: +CME ERROR: operation not supported
For this reason is unavailable also inside winbox

But you can obtain it with this command:

v6 and v7 code

/int lte at-chat lte1 input="AT%CCID"
  output: +ICCID: 8548512350010720871

Both:
:put [:pick ([/int lte at-chat lte1 input="AT%CCID" as-value]->"output") 8 27]
8548512350010720871
 
holvoetn
Forum Guru
Forum Guru
Posts: 5320
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: LTE SIM info

Tue Apr 05, 2022 10:26 pm

Sorry ...
[xyz@MTSXTLte] > /int lte at-chat lte1 input="AT%CCID"
  output: ERROR
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: LTE SIM info

Tue Apr 05, 2022 10:51 pm

Sorry ...
[xyz@MTSXTLte] > /int lte at-chat lte1 input="AT%CCID"
  output: ERROR
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...
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: LTE SIM info

Tue Apr 05, 2022 11:03 pm

This is the ROUGH AT manual for the R11e-LTE-US, but don't know how applicable it is to ALL R11e modems... but it documents the AT%CCID command:

https://www.avnet.com/opasdata/d120001/ ... e-v1.2.pdf
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: LTE SIM info

Tue Apr 05, 2022 11:07 pm

On my example, you can read it R11e-4G, but is unavailable with monitor/info

Thanks for the fix about info/monitor on v6/v7

For obtain all supported commands:
/int lte at-chat lte1 input="AT+CLAC" wait=yes
and depend on modem version what comands are supported
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: LTE SIM info

Tue Apr 05, 2022 11:12 pm

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.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: LTE SIM info

Tue Apr 05, 2022 11:14 pm

Interesting question, but I need a spare SIM to test with PIN enabled.
On production I do not use SIMs with PIN
 
ceres
just joined
Topic Author
Posts: 13
Joined: Fri Nov 05, 2010 7:18 pm

Re: LTE SIM info

Wed Apr 06, 2022 10:54 am

Hi All,

tried everything you suggested, with no luck.

Device: hAP ac³ LTE6 kit LTE RBD53GR-5HacD2HnD&R11e-LTE6
SW Version: 6.47.10

Lte interface up and running:
 /interface lte info 0 once
           pin-status: ok
  registration-status: registered
        functionality: full
         manufacturer: "MikroTik"
                model: "R11e-LTE6"
             revision: R11e-LTE6_V025
     current-operator: 22288
                  lac: 20393
       current-cellid: 55296257
               enb-id: 216001
            sector-id: 1
           phy-cellid: 37
    access-technology: LTE (CA2)
       session-uptime: 19m15s
                 imei: 35666210140xxxx
                 imsi: 22288545205xxxx
                 uicc: 893988084511168xxxx
         primary-band: B3@20Mhz earfcn: 1650 phy-cellid: 37
              ca-band: B7@20Mhz earfcn: 3350 phy-cellid: 432
                 rssi: -65dBm
                 rsrp: -95dBm
                 rsrq: -10dB
                 sinr: 8dB
Results:
 /interface lte at-chat lte1 input="AT%CCID"
  output: ERROR

 /interface lte at-chat lte1 input="AT+ICCID"
  output: ERROR
 
  /interface lte at-chat lte1 input="AT+QCCID"
  output: ERROR
  
  /interface lte at-chat lte1 input="AT+ICCID\?"
  output: ERROR

/int lte at-chat lte1 input="AT+CLAC" 
  output: ATE ATI ATL ATM ATO ATP ATQ ATT ATV ATX ATZ AT&C AT&D AT&F AT&S AT&Z ATS0 AT+CGMI AT+CGMM AT+CGMR AT+CGSN AT+CSCS AT+CIMI 
          AT+ASTO AT+GMI AT+GMM AT+GMR AT+GSN AT+GOI AT+GCAP AT+GCI AT+IPR AT+ICF AT+IFC AT+IDSR AT+EXAMPLE AT^HVER AT ATA ATD ATH 
          AT+MVSYNAUD AT+CDU AT+CMOD AT+CBST AT+CVHU AT+CRLP AT+CMUT AT+ECHUPVT AT+CTTY AT+CREG AT+CIND AT+COPS AT+CPOL AT+COPN AT+CLCK 
          AT+CPWD AT+CLIP AT+CLIR AT+COLP AT+COLR AT+CNAP AT+CCFC AT+CCWA AT+CHLD AT+CUSD AT+CAOC AT+VTS AT+VTD AT+CSSN AT+CLCC AT+CEER 
          AT+PEER AT+CSQ AT*REJCAUSE AT+CPAS AT+CFUN AT*CFUN AT+CPIN AT+ZSEC AT+CPIN2 AT+EPIN AT*SIMDETEC AT+CTZR AT+CTZU AT*CTZR AT+CCLK 
          AT*PINCNT AT+CPBS AT+CPBR AT+CPBW AT*CPBR AT*CPBS AT+CPBF AT+CSVM AT+CSIM AT+CRSM AT+CGLA AT+CRLA AT+CCHO AT+CCHC AT+MSTK 
          AT*EUICC AT+CACM AT+CAMM AT+CCWE AT+CGREG AT+CGATT AT*CGATTC AT+ZGACT AT+CGACT AT+CGDATA AT+ZGDCONT AT*ZGDCONT AT+CGDCONT 
          AT+CGDSCONT AT+CGQMIN AT+CGQREQ
          
/int lte at-chat lte1 input="AT+CLAC" wait=yes
  output: ATE ATI ATL ATM ATO ATP ATQ ATT ATV ATX ATZ AT&C AT&D AT&F AT&S AT&Z ATS0 AT+CGMI AT+CGMM AT+CGMR AT+CGSN AT+CSCS AT+CIMI 
          AT+ASTO AT+GMI AT+GMM AT+GMR AT+GSN AT+GOI AT+GCAP AT+GCI AT+IPR AT+ICF AT+IFC AT+IDSR AT+EXAMPLE AT^HVER AT ATA ATD ATH 
          AT+MVSYNAUD AT+CDU AT+CMOD AT+CBST AT+CVHU AT+CRLP AT+CMUT AT+ECHUPVT AT+CTTY AT+CREG AT+CIND AT+COPS AT+CPOL AT+COPN AT+CLCK 
          AT+CPWD AT+CLIP AT+CLIR AT+COLP AT+COLR AT+CNAP AT+CCFC AT+CCWA AT+CHLD AT+CUSD AT+CAOC AT+VTS AT+VTD AT+CSSN AT+CLCC AT+CEER 
          AT+PEER AT+CSQ AT*REJCAUSE AT+CPAS AT+CFUN AT*CFUN AT+CPIN AT+ZSEC AT+CPIN2 AT+EPIN AT*SIMDETEC AT+CTZR AT+CTZU AT*CTZR AT+CCLK 
          AT*PINCNT AT+CPBS AT+CPBR AT+CPBW AT*CPBR AT*CPBS AT+CPBF AT+CSVM AT+CSIM AT+CRSM AT+CGLA AT+CRLA AT+CCHO AT+CCHC AT+MSTK 
          AT*EUICC AT+CACM AT+CAMM AT+CCWE AT+CGREG AT+CGATT AT*CGATTC AT+ZGACT AT+CGACT AT+CGDATA AT+ZGDCONT AT*ZGDCONT AT+CGDCONT 
          AT+CGDSCONT AT+CGQMIN AT+CGQREQ AT+CGEQREQ AT+CGEQMIN AT*REPORTIP AT+GETIP AT*TGSINK AT*TGSINK AT+CGSEND AT*ICSSINK AT+ZGPCOAUTH 
          AT*AUTHReq AT+FCLASS AT+CMGF AT+CMSS AT+CMGS AT+CMGC AT+CMGR AT+CMGW AT+CSCA AT+CSCB AT+CNMI AT+CGSMS AT+CMMS AT+CMGD AT+CMGL 
          AT+CSMS AT+CPMS AT+CSDH AT+CNMA AT+CSMP AT+CGCI AT+CGOI AT+VDUMP AT+LOG AT+VPDUS AT+VHDL AT+VECHO AT+ATDB AT*CCIREG AT+CPUC 
          AT+CHUP AT+CSTA AT+CRC AT+CMEE AT+CMER AT+CMEC AT+CLAC AT+CBC AT+CDIP AT+CPLS AT+CGCMOD AT+CNUM AT+DS AT+CGTFT AT*BAND 
          AT*BANDIND AT+WS46 AT*CLCK AT+LOCKLEVEL AT+ZNCK AT*MEPCG AT*ENVSIM AT*CNMA AT*POWERIND AT*APPOWERIND AT*FASTDORM AT+EEMOPT 
          AT+EEMGINFO AT*ZAIRINFO AT*ZCQI AT+ERGA AT+ERTCA AT+LPNWUL AT+LPLOCVR AT+LPECID AT+LPOTDOAABORT AT+LPOTDOAREQ AT*CELL 
          AT*SYSSLEEP AT*CP_MIPS AT*MRD_CDF AT*MRD_SN AT*MRD_SECOND_SN AT*MRD_HWINFO AT+RESET AT+POWEROFF AT+RSTSET AT*MRD_WIFISSID 
          AT*MRD_WIFISSID_5G AT*MRD_IMEI AT*CALINFO AT*MRD_MEP AT*MRD_WIFIID AT*MRD_BTID AT*MRD_VEND AT*MRD_BAND AT*PROD AT+LOCKNETLIST 
          AT+LOCKLIST AT+UNLOCKKEY AT+GPSSTEST AT*GPSTEST AT*GPSRST AT*TDTR AT*GSMTR AT*TGCTRL AT*WBTR AT*RFC AT*MRD_DUMP AT*CPMRD_DUMP 
          AT*MRD_AUTH AT+FUELGAIC AT*MRD_LIST AT*MAXPOWER AT+CKPD AT+OFF AT*CGSN AT*MODEMTYPE AT$VTS AT*MODEMRESET AT*SWITCHMODEM 
          AT*HTCCTO AT+CMEMFULL AT*EHSDPA AT^DCTS AT^DEELS AT^DEVEI AT^DNPR AT^DUSR AT+CIREG AT+CGEQOS AT+CEREG AT+CGCONTRDP AT+CGSCONTRDP 
          AT+CGTFTRDP AT+CGEQOSRDP AT+CGEREP AT+CVMOD AT+CEMODE AT+CGPADDR AT+CGPIAF AT^CACAP AT+CGCLASS AT+CESQ AT*CESQ AT+BGLTEPLMN 
          AT*FDY AT^SYSINFO AT*DIALE AT*CPBC AT*FDNBYPASS AT*RSTMEMFULL AT*CSCB AT*CBMCS AT*NASCHK AT*USBT AT*MOBILEDATA AT*GATR AT*CGATT 
          AT*GRIP AT*PSPG AT*CGMR AT*READVER AT*COMCFG AT+VZWRSRP AT+VZWRSRQ AT*CGDFLT AT*CGDFAUTH AT*VZWTESTAPP AT+VZWAPNE AT*LTEBAND 
          AT*RFTEMP AT*CSQ AT+LTEPOWER AT*LTECOEX AT%MBMSCMD AT%MBMSEV AT+CEN AT+CNEM AT*SINR AT*RSSI AT*RSRP AT*RSRPP AT*RSRPS AT*RSRQ 
          AT*RSRQP AT*RSRQS AT*CQI AT*URSLCT AT+CISRVCC AT+CEVDP AT+CVDP AT+CEUS AT+CAVIMS AT+CASIMS AT+CMMIVT AT+CIREP AT+CSSAC AT*DONOF 
          AT*PWRPLMN AT*CISCC AT*RANDFILL AT$CSQ AT$CREG AT$CCLK AT*CSG AT*APCFG AT*ISIMAID AT+MPBK AT*CIIND AT*PRXYSET AT*PRXYRSP 
          AT*CHDSTST AT+CNMPSD AT+CSAS AT+CRES AT*TELMODE AT*PSDC AT*CBRAT AT*IMLCONFIG AT*IGN AT*FRATLIST AT*PCO AT+CSDF AT+RSRP AT+RSRQ 
          AT+RSCP AT+ECNO AT+CLAN AT*CELLINFO AT+CCUG AT+CPNER AT*CATPROF AT*CATEN AT*RCATR AT*CATTR AT*CATENV AT*RCATE AT*AUDIOMODE 
          AT*AUDIODEVICE AT*AUDIOVOL AT*AUDIOMUTE AT*ECALLDATA AT*ECALLVOICE AT*ECALLCFG AT*ECALLONLY AT*ECALLREG AT*SIMPLUG AT*CGDCONTL 
          AT*SPIND AT*ECCLIST AT*IMSSRV AT+CPLMNS AT+CACL AT*DCONF AT*CGCLASS AT*CIWLANCID AT*BTSCNCT AT*BTSDISSCNCT AT*BTSTAPDU 
          AT*BTSTATR AT*BTSCTRL AT*BTSCRSTAT AT*BTSTP AT+OPERCFG AT*ICCID AT*PARK AT*CHECKEMER AT+CECALL AT*RPM AT*TEMPTEST AT*ZFACTORY 
          AT+ZDON AT+ZSNT AT+ZCAINFO AT+ZCACFG AT+ZRSSI AT+ZNLOCKBAND AT+ZPAS AT+ZCELLINFO AT+ACONFIG AT+IMSFUNC AT+ZVN AT+ZSTM AT+ZSELM 
          AT+ZSELI AT+ZBK AT+ZINKR AT+ZINPR AT+ZDISTR AT+ZNITZ AT+ZSYNCNITZ AT+ZDOGREF AT+ZATNUM AT+STRESS AT+SULOG AT+MEDCR AT+MIPLVER 
          AT+MIPLCREATE AT+MIPLDELETE AT+MIPLADDOBJ AT+MIPLDELOBJ AT+MIPLOPEN AT+MIPLUPDATE AT+MIPLCLOSE AT+MIPLDISCOVERRSP AT+MIPLREADRSP 
          AT+MIPLWRITERSP AT+MIPLEXECUTERSP AT+MIPLPARAMETERRSP AT+MIPLOBSERVERSP AT+MIPLNOTIFY AT+ZDHCPLEASE AT+GEFLAG AT+ZCFG AT+ZROAM 
          AT+ZVMAIL AT+ZGDFLT AT*ZCGMR AT+WIFISSID AT+WIFICHANNEL AT+WIFIFUN AT+SDCARD AT+FUNC AT%EXE AT%SRVCHANGE AT+OTADOWNLOAD 
          AT*CPMRD_LIST AT+SWITCHNETWORK AT+MIFIVER AT*MRD_BANDSUPPORT AT*BANDSUPPORT AT+FDEL OK
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)
 
ceres
just joined
Topic Author
Posts: 13
Joined: Fri Nov 05, 2010 7:18 pm

Re: LTE SIM info

Wed Apr 06, 2022 11:05 am

Found a way
/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.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: LTE SIM info

Wed Apr 06, 2022 5:33 pm

Found a way
/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.
And that works if there is a PIN code set?
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: LTE SIM info

Wed Apr 06, 2022 5:40 pm

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
 
holvoetn
Forum Guru
Forum Guru
Posts: 5320
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: LTE SIM info

Wed Apr 06, 2022 5:42 pm

<someone has got too much free time ...>
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: LTE SIM info

Wed Apr 06, 2022 5:50 pm

<someone has got too much free time ...>
Better than watching the news.

And you'll note I skipped the parsing of the result, that's actually more annoying.
 
ceres
just joined
Topic Author
Posts: 13
Joined: Fri Nov 05, 2010 7:18 pm

Re: LTE SIM info

Wed Apr 06, 2022 6:24 pm

Found a way
/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.
And that works if there is a PIN code set?
I hope, I'll try tomorrow morning, I didn't have access to a board without PIN code set today.

I've checked the devices currently deployed and found that I can sit with just 3 commands:

"AT+ICCID" (Chateaux)
"AT+ICCID?" (SXT R, Wap)
"AT*ICCID?" (Hap Ac3, LHG, some SXT, some Wap)

I've also wrote a script, a little more "brutal"
:local SN value=[/system routerboard get serial-number];
:local Model value=[/system routerboard get model];
:local ICCID;

:local tmp;

:local data "";

:do {
    :foreach at in {"AT+ICCID"; "AT+ICCID\?"; "AT*ICCID\?"} do={
        :set $tmp [/int lte at-chat lte1 input=$at as-value];
        if ($tmp->"output" != "ERROR") do={
             /break
        }
    }
} on-error= {
    :local start value=[:find ($tmp->"output") " "];
    :set $ICCID [:pick ($tmp->"output") ($start+1) ($start+20)];
}

if ([:len $ICCID]!=0) do={
    :set data ("iccid=" . $ICCID . "&sn=" . $SN . "&model=" . $Model);
    /tool fetch url=$baseUrl http-method=post http-data="$data" http-header-field="X-Api-Key: $apiKey" keep-result=yes dst-path=provision.auto.rsc;
}
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: LTE SIM info

Wed Apr 06, 2022 6:30 pm

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".
[...]

missing the "?" at the end, sometime is required, sometime must not be present

[...]
I've also wrote a script, a little more "brutal"
[...]

Is better read "AT+CLAC" and search what CCID is supported inside, like the found "AT*ICCID"
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: LTE SIM info

Wed Apr 06, 2022 7:57 pm

A couple general notes here:
  • with "at-chat" it's always possible that "unsolicited response" can appear in the output (e.g. like "+CGREG: 1" or stuff for SMS etc...), so the [:pick ] may fail unless your careful...
  • while a SIM card's ICCD is numeric, it's actually too big a number for ROS script's "num" type. And, it doesn't warn you about. Instead, it seems to take the bits of the unsigned number from the ICCID number, but then just returns "max int" – so it come back different. e.g. you can see what happen if create a variable with a ICCID number, at least in V7:
    :global myiccid 89148000006911111111
    :put "$myiccid $[:typeof $myiccid] "
    # 9223372036854775807 num 	
    
(edit & note: 9223372036854775807 in base-10 is 0x7FFFFFFFFFFFFFFF in base-16/hex)


@rextended, fair enough re the "?" – but in V6 that's "\?" while in just "?" in V7, so yeah ignored that too in my quick example... But since your the "script type" expert, you may be interested in the 2nd point above...
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: LTE SIM info

Wed Apr 06, 2022 8:26 pm

I not understrand... what you have understand about my "?"

It's about (ignoring v6/v7) test both "AT+ICCID" (R11e-LTE6) and "AT+ICCID?" (R11e-4G)

Or at this point, simply check Model of R11e-xxx inside the script and test raw only on unknow model
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: LTE SIM info

Thu Apr 07, 2022 5:00 pm

I not understrand... what you have understand about my "?"
Just pointing out to the OP, to be careful with the "at-chat", since the escaping of "?" – which is pretty common in AT requires DIFFERENT handling on V6 vs V7. e.g. "AT+CGDCONT\?" vs "AT+CGDCONT?".

Also, since the OP is wring a "automatic SIM card PIN reset script", any script error could leave his PIN change in a bad state... I read signal data using script all the time & I'll see occasional "random AT stuff" (e.g. unsolicited responses) when parsing for signal data. In our case, we can easily ignore a "bad reading". But if the OP in the middling of changing the PIN code of the SIM card, boy that's whole different problem to handle in a script.
 
ceres
just joined
Topic Author
Posts: 13
Joined: Fri Nov 05, 2010 7:18 pm

Re: LTE SIM info

Thu Apr 07, 2022 6:43 pm

Just pointing out to the OP, to be careful with the "at-chat", since the escaping of "?" – which is pretty common in AT requires DIFFERENT handling on V6 vs V7. e.g. "AT+CGDCONT\?" vs "AT+CGDCONT?".

Also, since the OP is wring a "automatic SIM card PIN reset script", any script error could leave his PIN change in a bad state... I read signal data using script all the time & I'll see occasional "random AT stuff" (e.g. unsolicited responses) when parsing for signal data. In our case, we can easily ignore a "bad reading". But if the OP in the middling of changing the PIN code of the SIM card, boy that's whole different problem to handle in a script.
Actually it isn't a big deal. I just need to retrieve the iccid and send it to a server in order to get the final config, if the iccid isn't correct the server will simply send a 404 error.

Obviously the cpe will initially have an initial config with my autoprovision script that run every X minutes and internet access via ether1.
Is better read "AT+CLAC" and search what CCID is supported inside, like the found "AT*ICCID"
Probably yes, but for my needs it's a lot faster to just try the 3/4 commands that can work on my CPEs.
 
eagle2k
just joined
Posts: 3
Joined: Mon May 09, 2022 11:38 pm
Location: Kakamas, Northern Cape, South Africa

Re: LTE SIM info

Mon May 09, 2022 11:44 pm

@rextended

Hi

I'm struggling with the following USSD

Code as follow:

/interface lte at-chat lte1 input="AT+CUSD=1,\"*136*5#\",15" wait=yes

all works good with replies looking as follow

/interface lte at-chat lte1 input="AT+CUSD=1,\"3\",15" wait=yes

But

At the 5th reply it asks me to enter the phone number which I do as follow but it doesn't work

#Phone number is 10 digits
/interface lte at-chat lte1 input="AT+CUSD=1,\"0732542544\",15" wait=yes

The error which I get from the ISP is invalid number. But when I do it on my phone it accepts the number

What is the format? I'm assuming it only takes/registers the first 0 and then sends error back

How do I reply with the whole number ?

Who is online

Users browsing this forum: Cloudtechiq [Bot], erlinden, gigabyte091 and 25 guests