What is a SIM bank and how does it work

    Devices such as VoIP GSM gateways are growing in popularity among Russian companies and entrepreneurs. The scope of their application is quite wide - starting with saving company money on calls to mobile numbers, ending with various SMS mailings. The needs of many companies are not limited to one, even the most powerful, gateway. When using several such devices, especially geographically distributed, the labor costs for their support and administration increase significantly. Devices called SIM-banks can not only simplify the work with several VoIP GSM gateways, but also add a lot of interesting features to the latter. Today, using the SMB32 and SMB128 SIM banks as an example, we will get to know each other and learn how to work with this class of devices.

    What is a SIM Bank

    A SIM bank is a device for aggregating SIM cards in one place. Simply put, this is a device into which SIM cards are physically connected, and the SIM card is connected to a GSM gateway via an IP network. This means that GSM gateways can be installed anywhere - even in different cities and countries, while the SIM cards themselves will always be at your fingertips. At the same time, for the telecom operator, the registration point of the SIM card will be the location of the gateway with which it is currently working, and not its actual location.

    The aggregation of multiple SIM cards in one device is the main function of the SIM bank. But it can also perform other functions, for example:

    • centralized SIM card management;
    • hot swap / install SIM cards;
    • automatic distribution of SIM cards between GSM gateways according to temporary rules;
    • automatic replacement of SIM cards on GSM gateways when certain events occur or according to time criteria.

    Thanks to the SIM bank, you can at any time swap SIM cards in gateways located in different parts of the city or program a scenario whereby SIM cards are automatically tied to another GSM gateway and thereby create the illusion of a SIM card moving for a telecom operator.

    What are the SIM-banks

    Perhaps the most popular devices of the class SIM-bank are those that are released under the name GoIP. There is a model SMB32 for 32 SIM-cards, and there is a model SMB128 , respectively, for 128 SIM-cards. We had on hand an older model and a pair of four-channel VoIP GSM gateways GoIP 4 . The settings described in the article will also apply to the younger model SMB32 and to other models of VoIP GSM GoIP gateways (one channel, eight, sixteen). On the left is the SMB32 SIM bank, on the right is the SMB128 SIM bank

    But what you should pay attention to is the manufacturer of the devices. According to the glorious Chinese tradition, at least two companies produce VoIP GSM gateways called GoIP - Hybertone and DBL. Although these devices are identical at the hardware level, they may have software differences. Everything described in this article applies to GSM gateways and SIP banks manufactured by DBL. Unfortunately, I cannot guarantee the applicability of these settings to Hybertone devices.

    To complete the picture, it is worth noting that SIM-banks are also produced by another manufacturer of VoIP GSM gateways - Dinstar company. They have models for 64 and 128 SIM cards, however, unfortunately, they have not been able to work with them yet.

    SIM Bank Operating Modes

    GoIP SIM-banks can work in two modes: act as a server for GSM-gateways or work together with the free SMB Scheduler Server software. The first option is simpler, but has some limitations. It is suitable for those companies that use the same SIM-bank and do not plan to transfer SIM-cards in it between different gateways. Working with the SMB Scheduler Server is devoid of these restrictions - according to the developers, up to 10,000 SIM cards are supported, as well as the possibility of their distribution both between the channels of one gateway and between the gateways themselves.

    We will consider both of these options - from simple to complex. But first you need to register our GSM gateways with IP-PBX, in our case it will be Asterisk. Those familiar with both GoIP GSM VoIP Gateways and Asterisk can simply skip the next section.

    Connecting a GoIP Gateway to an Asterisk SIP Server

    At first, quite a bit of theory. GoIP GSM gateways can register on a SIP server in four different ways:

    • Single Server Mode - in this mode, the GoIP gateway is registered on the remote SIP server with just one account. All incoming and outgoing calls for all lines on the gateway will go through one SIP connection. In this case, routing is carried out by substituting the prefix for the called number in accordance with the GSM line used at the gateway.

    • Config By Line - in this mode, for each GSM line at the gateway, its own independent settings are made. Accordingly, a separate account is created for each line on the SIP server. In this mode, each line on the GSM gateway can be registered on its SIP server.

    • Config By Group - this mode is a combination of Single Server Mode and Config By Line - all lines on the gateway are grouped, and each group has its own SIP settings. Accordingly, the lines combined into one group use the SIP connection corresponding to this group.

    • Trunk Gateway Mode - the main feature of this mode is the ability to connect to a SIP server without registration. Call routing, as in the first mode, is based on the prefixes that are set for each line.

    For the basic configuration of the GoIP - Asterisk bundle, we will use the fourth option, but in registration mode. We will send all incoming calls to SIM cards to some extension number on the PBX. We will route outgoing calls based on prefixes: depending on which SIM card you want to call, Asterisk will substitute a specific prefix in the called number. The gateway will analyze the prefix, after which it will drop it and send the call through the desired SIM card (channel).

    In Asterisk we create a SIP feast for our gateway with the Line ID parameter - 70064 (these are the last five digits of the gateway serial number, for convenience):

    File /etc/asterisk/sip.conf

    As I already said, the GSM gateway in our example will distribute outgoing calls along its lines, based on the number prefix. But for this we need Asterisk to add these prefixes to numbers, guided by some kind of logic. In our case, there will be no special logic - Asterisk will in turn add the prefixes 011, 012, 013 and 014 (which correspond to 1-4 lines of the gateway) until it finds an idle line and the call does not pass. When playing with a number mask, you can build a more flexible outbound line selection logic based, for example, on which telecom operator the called number belongs to.

    exten => _8XXXXXXXXXX,1,Dial(SIP/goip70064/011${EXTEN}) ; Звонок через первую GSM линию
    exten => _8XXXXXXXXXX,n,Dial(SIP/goip70064/012${EXTEN}) ; Звонок через вторую GSM линию
    exten => _8XXXXXXXXXX,n,Dial(SIP/goip70064/013${EXTEN}) ; Звонок через третью GSM линию
    exten => _8XXXXXXXXXX,n,Dial(SIP/goip70064/014${EXTEN}) ; Звонок через четвертую GSM линию
    exten => _8XXXXXXXXXX,n,Hangup()
    File /etc/asterisk/sip.conf

    Now in the GoIP web-interface we go to the section Configurations - Basic VoIP . For the Config Mode option, select the Trunk Gateway Mode option - the corresponding settings for this mode will be displayed below. In the SIP Trunk Gateway1 option, specify the IP address of our SIP server or its domain name. The Phone Number option specifies the name of the peer created on the SIP server side, in our case it is goip70064 . Re-register Period (s) - indicates the time interval in seconds for re-registration on the SIP server; we indicated 60 seconds, if you specify 0, then registration will not be carried out. Next comes the optionAuthentication ID , where the name is indicated for authentication of the gateway on the SIP server and often coincides with the SIP peer name, in our case it is again goip70064 . Then the password is indicated in the Password option , we specified - pass70064 . In the last option, Routing Prefix - the prefix is ​​indicated on which outgoing calls will be distributed between GSM lines. In the extensions.conf file in Asterisk, we used the prefixes 011 - 014, which is why they should be specified here:

    • Line1: 011
    • Line2: 012
    • Line3: 013
    • Line4: 014

    After the basic connection settings, add the settings for incoming and outgoing routing. Inbound routing is available in the Configuration - Call In section . It is enough to indicate for each line in the Forwarding to VoIP Number option the number that will be called on the IP-PBX. In our case, I just indicated 5555 for all lines. In order to simply verify that calls really come from our GSM lines to the SIP server, this will be quite enough.

    Outbound routing is configured in the Configuration - Call out section . For each line, the Dial Plan parameter is configured., in which you need to register a rule that will remove the prefix (the same prefix that we set in the Configurations - Basic VoIP section ) at the beginning of the called number:

    • for CH1: 011: -011 |
    • for CH2: 012: -012 |
    • for CH3: 013: -013 |
    • for CH4: 014: -014 |

    For our example, these settings will be quite enough: we can make calls through the GoIP gateway lines, add the corresponding prefix to the called numbers, as well as receive calls from any GSM line, sending them all to the internal number 5555, which is connected to Asterisk. We made similar settings for the second GoIP gateway, which will also work with our SIM-bank.

    SIM bank as a server

    Connecting a GoIP Gateway to a SIM Bank

    Now we will connect our GoIP 4 GSM gateways to the SMB128 SIM bank operating in server mode. To do this, you need to put the SIM-bank in server operation mode and add accounts for each GoIP gateway. In the SMB128 Web interface, go to the Configurations - SIM Bank Settings section and select the Use Buil-in SIM Server option in the Operation Mode option . In the GoIP Clients section , add the required number of accounts for each GoIP gateway. You will need to fill in the following fields:

    • GoIP Type - GoIP gateway model, select from the drop-down list
    • Login ID - gateway identification number, used as a login to connect to the SIM bank. Must consist only of numbers. For convenience, you can use the last few digits of the serial number or MAC address of the gateway
    • Password - password for connecting to the SIM bank

    In our example, the following settings were obtained (other options remained in the default value):

    • Operation Mode : Use Built-in SIM Server
    • GoIP Type : GoIPx4 Login ID : 70064 Password : pass70064
    • GoIP Type : GoIPx4 Login ID : 70061 Password : pass70061

    Next, connect the GoIP gateways to the SIM bank. In the Web interface of the GoIP gateway, go to the Configurations - Preferences section . We put the Remote Server option in the Enable state , after which additional options will appear. We switch the Remote SIM to the Enable state - thereby indicating the gateway to use the remote SIM server mode. In the Server option, specify the IP address of the SIM bank or its domain name, in the ID option , the identification number of the gateway is indicated - the same Login ID that we used when setting up the account in the SIM bank. In the Password option, specify the corresponding password.

    SIM Card Distribution Rules

    As already mentioned, the mode of operation of the SIM bank as a server has some limitations. The most important of them is that each channel of each GSM gateway is allocated its own range of SIM cards, which cannot be used by other channels. That is, the entire range of SIM cards is divided into several disjoint sets, each of which is assigned to a specific GSM channel.

    It looks like this: in the Configurations - SIM Bank Settings section of the SIM bank’s Web interface there is the option # of SIM slots reserved per line, which indicates the number of SIM cards that can be used by each channel. In our example, we have two GoIP4 four-port gateways, totaling 8 channels. If in this option we specify, for example, the value "3", then the first channel of the first gateway will have access to SIM cards No. 1, No. 2 and No. 3, the second channel of the first gateway - No. 4, No. 5 and No. 6, and the first channel the second gateway - No. 13, No. 14 and No. 15.

    After we have allocated a plurality of SIM cards to each channel, we need to answer two questions: first, what event should happen for the SIM bank to replace the current SIM card for a GSM channel with another one from the set of channels assigned to the channel . Secondly, which SIM card should be replaced when this event occurs? We will give the answer to the first question in the next section, but the option answers the second questionSIM Schedule Mode . The following methods for choosing a working SIM card are available:

    • In sequence - sequential distribution - select the first SIM card in the list
    • At random - random selection of a working SIM card
    • Idle the longest - select a SIM card that is the longest in standby state
    • The fewest amount of outgoing calls - select the SIM card that has the least number of outgoing calls
    • The least amount of accumulative talk time - select the SIM card with the least total talk time

    Conditions for switching between SIM cards

    Now is the time to set up events, the occurrence of which entails switching to another SIM-card or performing SIM-banks any other actions. There are two subsections in the Configurations section for this :

    • Current Allocation Session - events that can occur right during the current session of the SIM card and even right during the conversation are configured. For example, this can be the achievement of a certain duration of the SIM card in active mode, the duration of the current call, the number of successful calls, the number of failed calls in a row, the first successful registration of the SIM card after appointment, and others (a full list of events is shown in the screenshot).

    • SIM Card History - events that are checked based on the accumulated statistics of the SIM card and are checked after each completed call through the SIM card, successful or unsuccessful. For example, this can be the achievement of a certain total duration of calls, the number of all calls, the number of failed calls, a decrease in the balance to a certain level, and others (again - in the screenshot).

    The following actions can be assigned to the onset of each event:

    • Null - no action assigned, nothing will happen
    • Re-allocate another SIM - assign another SIM card for this GSM line, the current SIM card will be put into standby mode
    • Disable the SIM and re-allocate another SIM - assign another SIM card for this GSM line, the current SIM card will be disabled, that is, excluded from the many SIM cards assigned to the line.
    • Re-assign a new IMEI - assign a new IMEI value for this GSM line
    • Disable the SIM and Re-assign a new IMEI and re-allocate another SIM - disable the current SIM card, then assign a new IMEI value and assign a different SIM card for this GSM line
    • Check Balance - check the balance on the account of the current SIM card. For this item to work, you need to make settings in the Configurations - Get Balance section
    • Display Warning - display a warning that will appear in the section for monitoring the status of SIM slots - section SIM Slot Status

    In principle, these are all the basic settings when the SIM bank is in server mode. The only thing you should pay attention to is the correct installation and removal of SIM cards. In order to do this safely, you must first turn off the power of the required slot. It is for this that the keys on the SIM-bank case are designed, however, it is much easier to do this using the Web interface. We go to the Install / Remove SIM Cards section and click on the header of the required slots. Gray color means that power is supplied to the slot, red color - no. Click Submit to confirm the action, install or remove the SIM card, turn on the power of the slot and confirm the action again with the Submit key .

    SIM card monitoring

    The SIM Slot Status section is intended for monitoring installed in the SIM bank of SIM cards . The data in this section is presented in table form, where each cell corresponds to one SIM card and contains the following information:

    • The cell name is the slot number (SIM 1, SIM 2, etc.). The name color changes depending on the status of the slot:

      • gray - the slot is not active or the SIM card is not installed
      • green - a SIM card is installed and this slot is turned on, that is, it is tied to one of the lines of the GSM gateway
      • blue - the SIM card is installed, but is in a standby state, in other words, it is not currently attached to the GSM gateway
      • red - power is off
    • S - (Status) displays the current status:

      • RUNNING - the SIM card is in operation, those are connected to the GSM gateway
      • SLEEP - A SIM card is installed, but is in a standby state, in other words, it is not currently tied to a GSM gateway
      • DISCNT - SIM card has been removed from the slot or power is turned off

    • B (Bind Line) - the number of the GSM line in conjunction with which this SIM card works; consists of <gateway identification number> + <GSM line number> - for example, for our gateway with ID 70064, the first line will be - 7006401, the second - 7006402 and so on.
    • G - (GSM Register) indicates whether the SIM card is registered or not: Y - registered, N - not registered.
    • T - (Call Time) total time of calls, in minutes
    • C - (Call Count) total number of calls

    Also, when you hover over a cell, a tooltip will appear with advanced status parameters and statistics for this SIM card.

    SIM bank as a client

    SIM-bank operation as a client is possible using the free Scheduler Server software. Scheduler Server is a software server that allows you to manage multiple GoIP gateways and SMB SIM banks at once. At the time of writing, the current release version of the software is 1.7.2 and is available for download here .

    When using Scheduler Server, the following features become available:

    • centralized management of multiple SMB SIM devices and GoIP gateways
    • static linking of the SIM card to the GSM gateway line
    • dynamic distribution of SIM cards between GSM gateways
    • automatic replacement of SIM-cards on GSM gateways when a certain event occurs
    • automatic SIM card switching from one GSM gateway to another

    Looking ahead, I note that the Scheduler Server has its own limitations in comparison with using the SIM bank as a server. First of all, this concerns the fact that switching between SIM-cards is possible only in time, in events - not.

    Install Scheduler Server

    System Requirements:

    • recommended as OS - Linux Centos 32-bit
    • Apache 2 or higher is recommended as an HTTP server
    • PHP 5 or higher
    • MySQL server version 5 or higher

    Network Requirements:

    • packet loss should not exceed 5%
    • packet transmission delay should not exceed 300 ms
    • one SIM channel can occupy a band of up to 11 Kbps

    After unzipping the resulting package, you need to run the smb_scheduler_install.sh script, which will ask a few clarifying questions and install everything, including the database. Further, all configuration is done in the web interface.

    How Scheduler Server Works

    The main role of the server is to connect the SIM card in the SIM bank with the GoIP line of the gateway. It works as follows:

    1. GSM-gateway and SIM-bank are registered on the Scheduler server
    2. Scheduler server connects the SIM card in the SIM bank with the line of the GSM gateway in accordance with the specified rules
    3. The GSM gateway registers the corresponding SIM card with the service provider

    There are two ways to distribute SIM cards: in fixed mode and in group assignment mode. The fixed mode is the establishment of a GSM-line connection - a SIM slot manually, this connection will not change until the user makes any changes. The group assignment mode is a dynamic mode for creating GSM-line communications - a SIM slot.

    Group Assignment Mode

    Unlike the mode of operation of the SIM bank as a server, where each group of SIM cards can only be tied to a specific GSM channel, the use of the Scheduler Server provides much more possibilities for distributing SIM cards. It works as follows: groups are created to which you can bind any slots in the SIM bank or any GSM lines of any GSM gateway. Accordingly, the distribution of SIM-cards on GSM-lines is carried out within these groups.

    However, there is another feature - each GSM-gateway (namely, a gateway, not a line) is attached to the zone. Zones are created by the user himself and, as conceived by the developers, should characterize the actual territorial location of the gateway. It is necessary to implement the function of emulating the movement of a SIM card: Scheduler Server is configured by default in such a way as to constantly switch SIM cards between gateways from different zones.

    In what cases does the SIM card switch? Alas, in the case of Scheduler Server only temporary conditions work. For each group, the following temporary rules for the distribution of SIM cards can be set:

    • cyclic interval - redistribution is performed at regular intervals, for example, every hour
    • according to the daily schedule - up to 9 time intervals are allocated for each day, each of which has one SIM-card. After this time interval, the SIM card goes into standby mode. When a new interval occurs, the next SIM card is assigned to the GSM line.
    • according to the weekly schedule - similar to the previous paragraph, but the schedule is assigned immediately for the whole week.

    The last question that needs to be answered is how the next one is selected for assigning a SIM card. The algorithm of work here is quite simple:

    1. For the first time, a SIM card and a GSM line from one group are randomly connected and put into operation
    2. When the working time ends, the SIM card and GSM-line disconnect and go into standby
    3. When a new working interval occurs, a new connection is collected, taking into account the following rules:

      1. SIM card will not be connected to the GSM line with which it was last connected
      2. The SIM card will not be connected to the line of the GSM gateway having the same zone number that was the last time

    Connect devices to the Scheduler Server

    First, using the Scheduler Server web-interface, you need to create accounts for all GSM-gateways and SIM-banks that will be connected to it. Accounts for GSM gateways are entered in the GoIP section . Click Add and fill in the following fields:

    • GoIP ID (number) : ID number (will be used as login when connecting)
    • GoIP Name : arbitrary name of the connected gateway
    • Password : password
    • Type : GoIP gateway model - select from the drop-down list
    • Group : the group into which GoIP will be included (if already created)
    • Zone ID : territorial zone number
    • Zone Name : arbitrary name of the territorial zone

    Accounts for SIM banks are created, respectively, in the SIM-Bank section . To add a new device, you need to fill in the following fields:

    • SIM Bank ID (Number) : ID number (will be used as login when connecting)
    • SIM Bank Name : arbitrary name of the connected SIM bank
    • Password : password
    • Type : type - SIM-bank model - is selected from the drop-down list
    • Group : the group in which the SIM bank will be included (if already created)
    • Остальные параметры относятся уже к тонкой настройке работы Scheduler Server, в рамках этой статьи мы их рассматривать не будем.

    We pass to the web-interfaces of our devices. Let's start with the GoIP GSM gateway. In the Configurations - Preferences section, set the Remote Server and Remote SIM options to Enable . In the Server option, specify the IP address of the Scheduler Server or its domain name, in the ID option the identification number of the gateway is indicated - the same GoIP ID that we used when setting up the account in Scheduler Server, in the Password field, specify the corresponding password. The Net protocol switch is set to UDP .

    Now we will register our SIM-bank on Scheduler Server. In the SMB128 web interface, go to the Configurations - SIM Bank Setting section and select Use External SIM Server in the Operation Mode option , and select SIM Server in the SIM Data Communications with option . All other settings are similar to the settings of the GSM gateway.

    Setting Group Assignment Mode

    The easiest way is to configure the group assignment of SIM cards in the section of the Configuration - Group Web interface . After the necessary number of groups has been created, you can bind the SIM bank slots to them - for this you need to click on the SIM link to the right of the group name. In order to manage the GSM-channels attached to the group, there is a GoIP link , and for managing the schedule - Scheduler .

    Setting Fixed Assignment Mode

    If you need to tightly attach one or several SIM cards to a specific GSM line of a specific GSM gateway, then the easiest way to do this is in the Monitor - GoIP Channel section .

    1. В строке с линией, к которой требуется привязать SIM-слот, в столбце Operation нажимаем Modify
    2. В опции Group выбираем None (for fixed bind mode)
    3. В опции Plan to bind Sim выбираем SIM-слот, если он уже доступен и нажимаем Save.
    4. Теперь переходим в раздел просмотра SIM слотов Monitor — SIM Slot
    5. В строке со слотом, который требуется привязать к GSM-линии, в столбце Operation нажимаем на ссылку Modify
    6. В опции Group следует выбрать None (for fixed bind mode)
    7. В опции Plan to bind GoIP Channel выбираем GSM-линию и нажимаем Save.

    This concludes our brief introduction to the basic functions of GoIP SMB SIM banks and Scheduler Server software. Possessing this basic knowledge, dealing with all the additional features will be much easier than doing it from scratch. For those who want to study the matter even deeper and / or get more functionality, I would advise you to pay attention to the GoAntiFraud interface . This is a third-party software developed specifically for managing and monitoring GoIP and SMB devices. It is distributed by subscription and costs, in general, pretty well. However, there is a 7-day trial period that allows you to get acquainted with all the possibilities and make a purchasing decision.

    Also popular now: