Procedure for SIM swap using API requests

The safe way to swap a SIM associated to a subscriber is:

  1. Add new SIM (if not already added) using set_sim_range
  2. Associate new SIM with a already allocated MSISDN using set_subscriber
  3. Delete old SIM using del_sim

Detailed procedure to replace a SIM associated with a MSISDN is represented below:

Add new SIM (if not already added)

Request set_sim_range

{
    “request”: “set_sim_range”,
    “node”: “hss”,
    “params”: {
        “sims”: [
            {
                “imsi”: “001010000000014”,
                “imsi_aux”: null,
                “iccid”: “001010000000014”,
                “extra_id”: “001010000000014”,
                “euiccid”: null,
                “ki”: “00112233445566778899aabbccddeeff”,
                “op”: “00000000000000000000000000000000”,
                “ims_ki”: “00112233445566778899aabbccddeeff”,
                “ims_op”: “00000000000000000000000000000000”,
                “public_ident”: null,
                “public_ident_alt”: null,
                “private_ident”: null,
                “wlan_ki”: “00112233445566778899aabbccddeeff”,
                “wlan_op”: “00000000000000000000000000000000”,
                “pin”: null,
                “puk”: null,
                “pin2”: null,
                “puk2”: null,
                “adm1”: null,
                “amf”: “0000”,
                “amf_lte”: “9001”,
                “ota_profile”: {
                    “cla”: “”,
                    “spi”: “”,
                    “kid”: “”,
                    “kic”: “”,
                    “tar_ram”: “”,
                    “tar_rfm_sim”: “”,
                    “tar_rfm_usim”: “”
                },
                “ota”: {
                    “kic”: “”,
                    “kid”: “”,
                    “kik”: “”
                }
            }
        ],
        “sim_profile”: “Elatech – ISIM”,
        “cs_active”: true,
        “ps_active”: true,
        “lte_active”: true,
        “wlan_active”: true,
        “ims_active”: true,
        “use_opc”: true,
        “ims_use_opc”: true,
        “wlan_use_opc”: true,
        “use_auc_idx”: false,
        “return_ids”: true
    }
}

If return_ids is set to true, it will return in response the allocated sim_id for that SIM.

Response

{
    “code”: 0,
    “sim_range”: {
        “count”: 1,
        “sim_ids”: {
            “001010000000014”: 891
        }
    }
}

Associate new SIM with an already allocated MSISDN

Request set_subscriber

{
    “request”: “set_subscriber”,
    “node”: “hss”,
    “params”: {
        “subscriber_id”: “531”,
        “msisdn”: “882801032”,
        “ims”: {
            “profile”: null,
            “fullname”: “”,
            “active”: false,
            “private_ident”: “”,
            “public_ident”: “”,
            “public_ident_alt”: “”
        },
        “sim”: {
            “imsi”: “001010000000014”,
            “iccid”: “001010000000014”
        },
        “eps”: {
            “profile”: “Postpaid data”
        },
        “ps”: {
            “profile”: “Prepaid data”
        },
        “cs”: {
            “profile”: “Postpaid Regular”
        },
        “ss”: {
            “passwd”: “”,
            “cfu”: “”,
            “cfb”: “”,
            “cfnrc”: “”,
            “cfnry”: “”,
            “cfnry_time”: “30”,
            “clir”: false,
            “clip”: true,
            “cnap”: null,
            “baoc”: null,
            “boic”: null,
            “boicExHC”: null,
            “baic”: null,
            “bicRoam”: null,
            “cw”: true,
            “hold”: true,
            “ect”: null,
            “multiPTY”: false
        },
        “sip”: null,
        “odb”: {
            “roam”: false,
            “baoc”: false,
            “boicExHC”: false,
            “baic”: false,
            “boic”: false,
            “bicRoam”: false,
            “bcfExHC”: false,
            “ps”: false,
            “psRoam”: false,
            “hplmnAP”: false,
            “vplmnAP”: false
        },
        “description”: “”,
        “extra_id”: null,
        “fixed_ipv4”: null,
        “fixed_ipv6”: null,
        “ue_usage_type”: null,
        “external_ident”: null,
        “ring_priority”: 1
    }
}

Response

{
    “code”: 0,
    “subscriber_id”: 531
}

Delete old SIM

Request del_sim

{
    “request”: “del_sim”,
    “node”: “hss”,
    “params”: {
        “sim_id”: “871”
    }
}

Response

{
    “code”: 0,
    “sim_id”: 871
}

Please note that you have to have the sim_id associated with the IMSI in order to delete it. If you don’t have it saved from when the IMSI was added, you can use the get_sims API request.

For further information, see:
https://yatebts.com/documentation/core-network-documentation/yatehss-hss-hlr/json-api-for-subscriber-management/#Request_del_sim
https://yatebts.com/documentation/core-network-documentation/yatehss-hss-hlr/json-api-for-subscriber-management/#Request_get_sims