> 5.4 | AT+CLCK Facility lock

> AT+CLCK can be used to lock, unlock or interrogate a network or ME <facility>. The command can be aborted when network facilities are being set or interrogated.
> Syntax

> Test Command AT+CLCK=?
> Response(s)
> +CLCK:list of supported <facility>s
> OK

> Write Command AT+CLCK=<facility>, <mode>[, <password>][, <class>]
> Response(s)
> if <mode> is not equal 2 and command successful:
> OK
> if <mode>= 2 and command successful:
> +CLCK: <status>[, <class>]
> [+CLCK: <status>[, <class>]]
> [+CLCK: ...]
> OK
> If error is related to ME functionality
> +CME ERROR

> Reference(s) |  | PIN |  | ASC0 | ASC1 | USB | MUX1 | MUX2 | MUX3 |  |  | Charge | Q | Last
> GSM 07.07, GSM 02.04, GSM 02.88, GSM 03.88, GSM 04.88 |  | + |  | + | + | + | + | + | + |  |  | - | ± | -

> Parameter Description

> <facility>(str)

> Phone security locks set by client or factory
> Primarily intended for the client to take safety precautions, "SC", "PS" and "FD" can be configured individually. "PS" may also be factory set.
> Parameter <class> is not applicable to security locks.
> See examples below for further details.
> “SC“
> SIM (lock SIM cards). SIM requests password upon ME power-up and when this lock command is issued.
> <password>: SIM PIN1.
> “PS“
> Phone locked to SIM card. ME requests password when other than current SIM card is inserted.
> "PS" lock is frequently referred to as "phone lock", or "device lock". Accordingly, the password may be called "phone code" or "device code". The "PS" password is not associated with the PUK of the SIM card. If incorrectly entered three times, the Master Phone Code is required to lift the lock. This is an 8-digit device code associated to the IMEI number of the mobile which can only be obtained from the manufacturer of the module. Once the Master Phone Code has been acctepted, the mobile is operational, and the "PS" lock is no longer active. If needed it must be set once again.
> <password>: User defined password. It is needed before the first use of <facility> "PS" and, therefore, must first be specified with AT+CPWD or AT^SPWD, if it has not been predefined by factory settings. If set by factory (e.g. for a prepaid mobile), the password is supplied by the provider or operator.
> “FD“
> SIM fixed dialing memory: If the mobile is locked to "FD", only the phone numbers stored to the "FD" memory can be dialed. (Capacity of the "FD" phonebook is depending on the SIM card).
> <password>: SIM PIN 2.
> If a lock on the SIM fixed dialing memory is active, the following applies:

> • | Outgoing voice, data or fax calls can be made only to numbers stored in the "FD" phonebook. Result code for voice, data and fax calls to numbers not stored in the "FD" phonebook is "+CME Error 257: Call barred".

> • | Access to defined Supplementary Services such as Call barring, Call waiting, Call forwarding, Call hold and Multiparty is possible only if the exact corresponding dialing numbers of the public MMI *# code (followed by the dialing number) for the desired service is stored in the "FD" phonebook and used with ATD. Using Supplementary Services ATD*#code without dialing number is possible. AT commands for supplementary service control are barred while "FD" lock is active. Indication is ''+CME Error 257: Call barred''.

> • | Access to Unstructured Supplementary Services ("USSD") is possible only if the exact desired USSD string is stored in the "FD" phonebook and used with ATD. AT commands for USSD are barred while "FD" lock is active. Indication is ''+CME Error 257: Call barred''.

> • | SMS can be sent only to phone numbers which are stored in the "FD" phonebook. Also a valid Service Center Address (international format) must be present in the "FD" phonebook to allow sending SMS at all. Indication is ''+CMS Error 302: operation not allowed''.

> • | GPRS commands can be used only if the "FD" phonebook contains an entry with phone number ''*99#''. This single entry enables all GPRS commands, including AT commands and modem compatibility commands like ''ATD*99***1#'' or ''ATD*98***1#''. Indication is ''+CME Error 257: Call barred''.

> Factory defined SIM locks:
> Typical examples of factory set SIM locks are prepaid phones or network locks, used to restrict the operation of a mobile to a specific provider or operator. The client should be aware that each of these lock types can only be unlocked if the associated password is available. For example, a mobile can be locked to accept only SIM cards from the respective provider, or even one single SIM card. Once a different SIM card is inserted the ME will prompt the client to enter a specific code. This is not the PUK of the SIM card, but usually an 8-digit code which needs to be requested from the provider.
> The locks can only be set by the manufacturer and need to be agreed upon between the parties concerned, e.g. provider, operator, distributor etc. on the one side and the manufacturer on the other side. For details contact your local dealer or Siemens AG.
> Parameter <class> is not applicable to SIM locks.
> <password> and instructions for unlocking must be obtained from the network provider.
> “PF“
> lock Phone to the very First SIM card
> “PN“
> Network Personalisation
> “PU“
> Network subset Personalisation
> “PP“
> Service Provider Personalisation
> “PC“
> Corporate Personalisation
> Supplementary Service Call Barring:
> Supplementary Service "Call Barring" allows to specify conditions under which calls will be disallowed by the network.
> The availability of the Supplementary Services varies with the network. To benefit from call barring the client will need to subscribe them, though a limited number of call barring types may be included in the basic tariff package.
> When you attempt to set a <facility> or <class> which is not provisioned, not yet subscribed to, or not supported by the module, the setting will not take effect regardless of the response returned. The responses in these cases vary with the network (for example "OK", "+CME ERROR: Operation not allowed", "+CME ERROR: Operation not supported" etc.). To make sure check the extended error response with AT+CEER and the lock status with <mode>=2.
> <password>: Network password supplied from the provider or operator. Usually there is one password which applies to all call barring options. For details contact your provider.
> “AO“
> BAOC (Bar All Outgoing Calls)
> “OI“
> BOIC (Bar Outgoing International Calls)
> “OX“
> BOIC-exHC (Bar Outgoing International Calls except to Home Country)
> “AI“
> BAIC (Bar All Incoming Calls)
> “IR“
> BIC-Roam (Bar Incoming Calls when Roaming outside the home country)
> “AB“
> All Barring services (applicable only for <mode>=0)
> “AG“
> All outGoing barring services (applicable only for <mode>=0)
> “AC“
> All inComing barring services (applicable only for <mode>=0)

> <mode>(num)

> 0
> unlock
> 1
> lock
> 2
> query status

> <status>(num)

> 0
> lock is inactive
> 1
> lock is active

> <password>(str)

> Password string used to lock and to unlock a <facility>. Length and authority for passwords depend on the <facility> in question and are therefore listed in the section on parameter <facility>. Passwords can be modified with AT+CPWD or AT^SPWD.

> <class>(num)

> Integer or sum of integers each representing a class of information, i.e. a bearer service, telecommunication service or bearer service group as defined in "GSM 02.04".
> 1
> voice
> 2
> class 2 ("data") comprises all those individual data classes between 16 and 128, that are supported both by the network and the MS. This means, a setting made for class 2 applies to all individual data classes (if supported). In addition, you can assign a different setting to a specific class. For example, you can activate Call Forwarding for all data classes, but deactivate it for data class 64, "dedicated packet access".
> 4
> fax
> 8
> SMS
> 16
> data circuit sync
> 32
> data circuit async
> 64
> dedicated packet access
> 128
> dedicated PAD access
> 1...[7]...255
> combination of some of the above classes.
> For example, the default setting 7 represents the sum of the integers 1, 2 and 4 (voice, data and fax).
> The value 255 covers all classes.
> If parameter "class" is omitted, the default value 7 is used.
> Notes

> • | The AT+CLCK command offers the full range of <class> parameters according to the GSM specifications. However, when you attempt to use a service option which is not provisioned or not yet subscribed to, the setting will not take effect regardless of the response returned. The responses in these cases vary with the network (for example "OK", "Operation not allowed", "Operation not supported" etc.). To make sure check the extended error response with AT+CEER and the lock status with <mode>=2.

> • | The command has been implemented with the full set of <class> parameters according to GSM 07.07. For actual applicability of a desired Call barring service to a specific service or service group (a specific <class> value) please consult table A.1 of GSM 02.04.

> • | If an outgoing Fax or Data Call is rejected due to an active ''call barring'' supplementary service, the call will be terminated with result code NO CARRIER. Under the same conditions, an outgoing Voice call will be terminated with result code NO DIALTONE.

> • | If an invalid <password> is entered several times in succession, a delay incremented after each failed attempt will increase the time to wait before the input of the <password> is accepted. To avoid blocking the serial interface the running AT+CLCK command is aborted after a short timeout and returns CME ERROR 100 ("unknown"). If then the AT+CLCK command is issued once again execution is denied with CME ERROR 256 ("Operation temporary not allowed"). For details regarding the delay see Section 5.1.1, What to do if PIN or password authentication fails?.

> • | If the user tries to set a lock although it is already active or, the other way round, tries to unlock an inactive lock, the response will be OK, but the <password> will not be checked or verified.

> • | In the airplane mode the write command version for the network related <facility> (AO, OI, OX, AI, IR, AB, AG and AC) is not supported. For remaining facilities the command is fully functional then.

> Examples

> EXAMPLE 1 | Lock SIM card (<facility>= "SC")

> AT+CLCK="SC",1,"9999" | The "SC" parameter enables or disables the SIM PIN authentication (PIN 1) when you power up the GSM engine
> OK | SIM card locked. As a result, SIM PIN 1 must be entered to enable ME to register to the GSM network.

> AT+CLCK="SC",0,"9999" | Unlocks SIM card.
> OK | When powered up, ME registers to the GSM network without requesting SIM PIN1. Note: Depending on the services offered by the provider, this feature is not supported by all SIM card types. If so, the command returns ERROR when you attempt to unlock the card.

> To query the status of the SIM card lock:

> AT+CLCK="SC",2 | Query the status of SIM card lock.
> +CLCK: 1 | SIM card is locked. SIM PIN1 must be entered to enable ME to register to the GSM network.
> OK

> EXAMPLE 2 | Phone lock (<facility>="PS")

> AT+CPIN? | Make sure that PIN1 authentication is valid.
> OK

> To lock the ME to the currently inserted SIM card, first specify a password for <facility> "PS":

> AT+CPWD="PS",,"1234" | If "PS" lock has not been set before: enter new password.
> OK

> Optionally, if "PS" password was defined before, change existing password:

> AT+CPWD="PS","1234","3333" | To replace existing "PS" password: Enter old and new password.
> OK

> Then, activate the Phone Lock:

> AT+CLCK="PS",1,"3333" | Locks the mobile to the current SIM card.
> OK

> To operate the mobile with the SIM card for which "PS" lock was activated:

> AT+CPIN?
> +CPIN: SIM PIN
> OK
> AT+CPIN="9999"
> OK | No additional password is required for operation (SIM recognized by mobile).

> To operate the mobile with other SIM card than the one used for the "PS" lock:
> Enter SIM PIN of present card, followed by "PS" lock password.

> AT+CPIN?
> +CPIN: SIM PIN
> OK
> AT+CPIN="1111"
> OK | PIN authentication accepted.
> AT+CPIN?
> +CPIN: PH-SIM PIN | "PS" lock password is required.
> OK
> AT+CPIN="3333"
> OK | "PS" Lock password has been accepted. ME is fully operational now.

> To deactivate the Phone Lock:

> AT+CLCK="PS",0,"3333" | Phone Lock password has to be provided again.
> OK | Now the mobile can be used with any SIM card, without the need of the phone lock password.