Setting up SIM reader

From Rhizomatica Wiki
Jump to: navigation, search
HOWTO Install: SIM Reader

We have two options for the SIM reader:

 - SIM Reader connected to the BSC
 - SIM Reader connected to the admin PC

In the first scenario the SIM reader is connected to the BSC and by uncommenting the required code in RAI (/var/rhizomatica/rai/provisioning.php) it will automatically extract the IMSI and the 5 digit extension assigned to a phone.

The second scenario is when the SIM reader is connected to the admin PC and so the admin has to manually input in RAI the IMSI of the user in "Subscriber number" field. In order to do that the user needs to put the SIM in the reader, click on an icon on the desktop that will run a program and show the IMSI. Copy that IMSI and put it in the subscriber number for the provisioning.

For both options the proper packages needs to be installed in the platform in order for this to work.

Step 1

Install the "card" python library from Github:

 git clone https://github.com/mitshell/card.git
 cd card
 python setup.py install

Step 2

Install the following packages:

 apt-get install libccid pcscd python-pyscard

Start pcscd if it's not already running:

 /etc/init.d/pcscd start

Step 3

Plug the SIM reader and put a SIM in it, try to run

 /var/rhizomatica/bin/get_imsi.py

If it's working you will see the IMSI.

//Note: in the admin PC there is no /var/rhizomatica you will have to copy the get_imsi.py script//


Step 4 (Only for Admin PC)

The Admin needs a way to see the IMSI in order to input the "Subscriber number" in RAI. In this admin PC you need to copy the get_imsi.py script but since /var/rhizomatica/ does not exists put the script under /usr/bin/ so it will be /usr/bin/get_imsi.py

Create the following bash script /usr/bin/gtk_get_imsi.sh

#!/bin/bash

IMSI=`python /usr/bin/get_imsi.py`
zenity \
--info \
--text="<span size=\"xx-large\">IMSI: $IMSI</span>" \
--title="SIM Reader" \
--ok-label="OK" 

Save the file and give exec permission. chmod +x /usr/bin/gtk_get_imsi.sh

From ubuntu graphical interface open a terminal. Put the SIM in the reader and launch the command to see that is working. gtk_get_imsi.sh

If it's working you can now create an icon on the desktop that will execute the /usr/bin/gtk_get_imsi.sh script.

Good luck!