Check Operator By Phone Number

When we try to determine which operator a phone number belongs to, we usually look at its DEF code. For example, if the number starts at 916, then this is MTS, at 968. Beeline, 926. Megaphone (it all depends on your region). But this method is very conditional and completely inappropriate when you need accurate data. In reality, everything is more complicated: DEF codes are often divided among themselves by several operators, and it is not necessary that the desired number refers to the operators of the Big Four. And finally, you can simply port the number.

In the article I will talk about how to reliably identify the mobile operator that serves it by the phone number, as well as get additional, “free” information. The subscriber’s home region. You can use this data as you like, starting from prefilling the address in the user profile and redirecting to the regional version of your service, to using this data in processing and statistics. At the end of the article there will be a link to github with source codes.

I’ll immediately make a reservation that the home region of the subscriber, by and large, is not connected in any way with the current location of the user, i.E. The defined region answers the question “Where is the number from?” rather than “Where is the user?”.


We get our phone number when we conclude a service contract with a telecom operator. In turn, the distribution of number ranges between telecom operators, as well as standardization and general control of telecommunication services are carried out by the relevant state and international organizations. Such an organization is the Federal Communications Agency (Rossvyaz).

Thus, Rossvyaz is the most reliable source of information who services the Russian phone number, and this is open data that the agency publishes on its website: A fresh list of mobile number ranges can be found in CSV here. Each line in the file looks like:

DEF code, beginning of range, end of range, operator name, region name

However, since 2013 it became possible to transfer the number from operator to operator. So, being guided only by the Rossvyaz registers, it is impossible to say unequivocally that the number is serviced by a specific operator. But this can be said about the region, because number portability works only within the home region and it will not work to transfer the number from MTS Novosibirsk to Tele2 St. Petersburg in principle.

Thus, if the task is to determine only the user’s region, then Rossvyaz registries will be enough.

Transferred Numbers Database

If you need to accurately determine the operator, then you can not do without the Database of Transferred Numbers, the operator of which is TsNIIS. The procedure for connecting to the database can be found on their website: zniis.Ru. But, unfortunately, as far as I know, it’s not easy to directly connect to them, but once you get the connection, you cannot share the database with anyone.

The structure of this database is extremely simple: these are three CSV files in which in the format “number, operator name” are listed:

  • All transferred numbers for the current day (updated once a day);
  • All transferred numbers for the last hour (updated once per hour);
  • All numbers returned to the native operator back in the last hour (updated once per hour).

At the time of writing, there are about 6 million records in the BDPN.

Summarizing: we have certain ranges of numbers that correspond to certain operators and regions (Rossvyaz), and a list of exception numbers from these ranges (BDPN), which applies only to the name of the operator.

How to identify subscribers

The most obvious solution to this problem: look at the word “range” and use the listed containers literally. Those. To determine the number, we sort all the operators by their ranges and look for a record that refers to the minimum range that a specific number falls into. The complexity of this algorithm will be like binary search, which is pretty good.

But there is a more original and universal way of implementation, the complexity of which is constant, regardless of the size of the data. This method involves using number masks.

Number mask

The number mask is a string consisting of numbers and a special character with the value “wildcard single character” (“?”), which says that in its place can be any number. Over, after the question mark can only be a question mark.

So one of the Beeline ranges “79031000000. 79031999999”, in the form of a mask will be written as “79031. “.

It is very convenient to work with such masks, for example, to set them manually in the configuration. In addition, representing ranges in the form of masks makes it possible to use more efficient storage methods and simple search algorithms.

Hash table

For example, one of such algorithms is storing the mask-operator correspondences in a hash table (or any other key-value storage). The essence of the algorithm is as follows: all such masks are added to a hash table, where they are keys. The values ​​in the table are operator objects with regions.

The search operation is most clearly explained by example. Say we are looking for information by number: 7 (903) 100-1234, and we have a mask 79031.. Beeline, Moscow.

First, look for the key record in the table exactly as the original number: 79031001234.
If not found, then change the last digit of the number to “?” and search by key 7903100123?.

If you didn’t find anything again, then again change the last digit to “?” and look for 790310012. And so on.

In the end we will do a key search 79031. And find that the number refers to the operator Beeline, Moscow.

It can be seen that in this case, the complexity of the algorithm is equal to the complexity of several takes from the hash table, which, if implemented correctly, is usually equal to a constant. The complexity of the search in such a tree depends on the length of the phone numbers, which, according to the recommendation of ITU-T E.164, does not exceed 15 characters.

The same algorithm can be applied to ported numbers. You can simply add them to the same hash table.

Prefix tree

A much more efficient method is the construction of a prefix tree from masks, which will rely on the fact that numbers consist of numbers. Each node of this tree can have up to 10 digital descendant nodes (0-9) and one wildcard node. A wildcard node can only have wildcard children. When you add another mask to the tree, each mask symbol will turn into a node in sequence. Thus, in fact, we represent all the masks we have in one tree.

For example, a tree consisting of masks:
7913? Mno1
791 ?? Mno3
7952. Mno2
7953. Mno3
795? Mno1
will look like in the picture (the listed masks in the tree go from left to right).

The search algorithm in the tree, I think, is already clear: we take in order each digit from the desired number and sequentially go down the tree starting from the root. First of all, we go down the digital nodes, if there are no digital nodes, then see if “?”-but yes. If there is, then in the end we check the length of the mask, and if it matches the number, then the operator is found.


Depending on the limitations, you can combine these approaches and separate the repositories of ported numbers and Rossvyaz masks. For example, from memory it is more advantageous to use a hash table approach for ported numbers, and it is always more profitable to use a mask tree for Rossvyaz registries. When searching, first look in the table, and if nothing is found in it, then look in the tree. Separation of storages is primarily convenient for their auto-update, i.E. If the BDPN has changed (and it is constantly changing), then it is not necessary to re-read the ranges of Rossvyaz.

For maximum performance, you can store all the information directly in RAM. In my implementation in Java, the Rossvyaz mask tree takes up no more than 20-30 MB, a hash table with port number masks: about 500-600 MB. If the ported numbers are stored in a prefix tree, then due to the fact that the tree nodes are very sparse, the memory will need about 1.5 times more. But on the other hand, this gives a fairly significant increase in productivity.

Regardless of the operating system and brand of the smartphone, the balance of the phone is checked in the same ways:

Check Operator By Phone Number


1. MTS. Checking the current balance through the USSD command
Having made the USSD request 100 #, information on the SIM card validity period and account balance (in Russian) will be displayed on the smartphone screen.
If the phone does not have Russian, the USSD command will be like this. # 100 #, information will be displayed in English.
Detailed information on the number of SMS, packet minutes, etc., can be found by executing the command 1002 #.
To determine the balance of GPRS USSD, the request looks like this. 111217 #.
It is possible to have the most current information of your account when connecting the service “Living balance” by entering USSD request 1523 #. With a daily cost of ten cents, after each SMS message, call, etc., the account balance will be displayed.

2. MTS find out the balance through the service number
Unable to view the information on the telephone screen, you can call 111. Following the instructions of the automatic information service and pressing the appropriate buttons, the rest of the account will be voiced by an answering machine. If you send an SMS to this number with the text 11, then the message with the account balance will come in a response message.

3. MTS find out the balance by phone number
You can check the balance on the phone account of another person, make a USSD request 140 phone number #. This command can be executed if the phone number is listed. “Favorite”.

4. MTS find out the status of your balance by calling the operator
You can make a call to the operator by number. 0890. This will take much more time, but may be as one of the possible options.


Five ways to check your account status. The main options for checking the status of the account are the same as for the previous operator.

1. Megaphone. Balance check via USSD command
You can find out the remaining funds by completing the request 100 #. For roaming, it is preferable to use 1111 #.
By connecting a service “Living balance”You can receive such information daily for 30 rubles per month. To do this, execute USSD request 1341 #.

2. Megaphone. Find out the balance through the service number
If you send an empty SMS to number 000100, the balance on the smartphone screen will appear in a few seconds. For constant control of the account balance, the SMS balance service is suitable. In case of any change in the balance, a notification will be sent via SMS. You can connect it by making USSD request 105600 #.

3. Megaphone. Find out your balance by calling the operator
You can contact the operator by calling 0501.

4. Megaphone. Find out the balance of another phone number
You can check the account status of other phones if they are added to a special list. Allowed subscribers. To do this, make USSD request 43819XXXXXXXXX #. And then from the number 9XXXXXXXXX it will be possible to check the balance in the account of your telephone number.

5. Megaphone. Find out the balance on the internet
You can check the balance by going to the site www.Megafon.Ru. At the top of the site will display information about the balance and phone number.


Checking the balance of your personal account occurs through a USSD request, a call to the operator or the application. Consider the options.

1. The balance will be displayed on the smartphone screen., supporting cyrillic, with the introduction of USSD request 102 #. If the phone does not display Russian letters, use a different set. # 102 #. Beeline postpaid system users use query 11045 #.

2. Using the internet, You can go to the site beeline.Ru and by logging into your account, see the status of the account.

3. You can find out the balance using conventional cellular and a call to answering machine 0697. The status of the account will be announced by the voice of the operator.

4. To constantly monitor the balance, execute USSD command 110901 #. Now on the smartphone screen will be displayed the status of the account after each call or message. The cost of the service per day is 1 ruble.

Tele 2

1. The main way to check the balance is to execute the USSD 105 # command, after which you need to press the call button.

2. To check your account, you can use the menu call. To do this, by completing the request 111 #, and pressing the call, the menu of your personal account will be displayed on the smartphone screen: 1. Balance 2. Tariff 3. Number 4. Personal account 0. Return

3. Call the operator’s answering machine at 697.

In some situations, a person needs to know where they called from by phone number. Using a mobile combination, you can determine a region, country, and other geographical features only using a mobile combination.

To use such a function, it is enough to use a simple and free service, or rather the line that is indicated above.

Through a specialized program on a mobile number, you can quickly find the country and region. The service is available to any subscriber; details are made for any mobile combination. The main countries for which users the function is available are Ukraine and Russia, but the service is suitable for other world countries.

To start checking the number, it’s enough to enter the contact in the line and press the key to display the details, or simply use the “Enter“.

After that, the user receives:

  1. The name of the mobile operator.
  2. The country and city from which the call was made.

For the correct display, you must correctly enter the mobile data. To do this, consider the code and other characters displayed on the screen of the mobile device.

The service will be very popular for customers who receive a call in an international direction and the contact is unknown. It is also recommended to use the program for those who need to recognize a fixed number. In this case, the country and city code is entered.

It is not recommended to call back to unfamiliar international numbers, since it is they who are often used by scammers and spammers. This will help save money on the balance of the phone.

I want to go to the mobile TELE2 with my number Rostov Yaroslavsky My online for 200r.

I do not quite understand. III.

I want tele2 another conversation S 20 GB 250 rubles

You do not write there! )

In exchange, the Super MTS tariff is charged 2.50 rubles per day. Not 1.50 as stated in the article

Where did you call the number how to connect to the phone and the cost

Hello! How to find out your full name The owner of the phone number “THANKS IN ADVANCE FOR ANSWER !!

Name vryatli who will tell you! )

Where did they call from the phone 7 9894006031

Who owns the phone 7 989 400 60 31

Hello, to know a private individual or company, company, perhaps?

I forgot the account number of MTS TV. How to restore?

Someone calls my number and drops the pipe. Calling from the number 79885681464

It was Pozdnov Vasily Vasilievich. Are you so familiar?

My body 2 open number 79940029936

89024581494 yuri bichakhanov

89024581494 yuri bichakhanov tele2

Which means: the number is not transferred.

Tell me, please, how to remove the ban on transfers?

An SMS message has been received from number 79918211662: You have been issued a fine for violation of isolation.

Hope these scammers send out similar messages.

I got a call from 445095876288, you can find out who it is.