CommuniGate Pro
Version 6.4
 

Integration with external services of IP Geolocation

The purpose of IP Geolocation is to determine the location of a device by its IP address.

Geolocation results are displayed in the admin and user interfaces, where the IP addresses are displayed.
Display example:

Temporary Blocked IPs

  Network Address Location Expires
[87.246.7.229] Europe, 🇬🇧 United Kingdom, England, London 5:48:57PM
[20.63.98.42] North America, 🇨🇦 Canada, Ontario, Toronto 5:59:16PM
[20.77.253.72] Europe, 🇬🇧 United Kingdom, Wales, Cardiff 6:05:16PM
[119.188.157.139] Asia, 🇨🇳 China, Beijing, Xicheng 6:25:05PM

Note: The display of emoji symbols with country flags depends on the OS and browser used. Specifically, on Windows it doesn't work in Chrome browser, but it works in Firefox.

Providers

There are many services that provide IP Geolocation provider service by answering queries over the network. Most of them are paid, and free ones can impose various limits on the frequency and the total number of requests.

Different services have different databases and different definition accuracy. The databases are updated based on information about IP addresses provided by Internet Service Providers. Therefore, the accuracy of Geolocation determination also depends on how accurately the data is entered into the IP address registry. Most often, it is impossible to determine the location more precisely than to the city level. Also, Internet Service Providers can provide IP addresses in other cities that are in their service to clients located in a different region, which can lead to an erroneous designation of the city. Sometimes the accuracy is not higher than the country level, since the registries of IP addresses allow not to indicate the city in the location column.

Integration

The integration is done by geolocationservice.sppr application from the main domain.

By default, the application is programmed for IPWHOIS.IO service with its "free plan" for less than 10,000 requests per month for non-commercial use. But it can be reprogrammed for other services..

It may take a few seconds for the request to be sent to the provider. Therefore, in CommuniGate Pro interfaces, information about the Geolocation of the IP address may not initially be shown, but will be shown later on when the page is refreshed.

The CommuniGate Pro core has a "cache" of responses to requests for IP addresses. That is, if a request for some IP address and display language was sent to the provider, then the request for this combination will not be sent in the future. Moreover, if the Geolocation data of "neighboring" addresses in the cache are the same, then for the entire range of intermediate IP addresses between them, the data will be considered the same, and requests for them will not be sent.

Filling the cache with initial data is carried out by geolocationinit.sppr application geolocationinit.spprfrom the main domain. The ranges of local and service IP addresses are filled for which there is no Geolocation. You can customize the application and assign ranges of LAN addresses, thus defining Geolocation within your organization.

Interfaces

Integration of CommuniGate Pro with IP Geolocation Services is available in for:

  • CG/PL server-side applications (PBX Tasks, WebUser applets, etc.).
  • XIMSS client applications.
  • CLI client applications.

Operations

The CLI command to manage the Geolocation cache is available:

IPGEOLOCATION ip-address [ parameters ]
ip-address : string or IP-Address
This parameter specifies the IP address to be checked.
parameters : dictionary
This dictionary should contain the op, string element, specifying the operation to apply. Other dictionary elements are operation-specific. By default the parameters are { op=get; lang=en; }

The following operations are available:

get
This operation returns data from the cache, or sends a request to the provider if there is no information for the given IP address and language in the cache.
Parameters:
lang : string
language code, en by default.
Results:
dictionary
dictionary keys:
status : string
wait or error. The wait value means that there was no information in the cache, the request was sent to the provider, and that the data should be re-requested in a few seconds.
Keys with language-neutral values:
c_m : continent code
c_c : country code
c_e : country flag emoji symbol
c_f : country flag image URL
c_r : region code
Language-dependent keys with values:
l_1 : continent name
l_2 : country name
l_3 : region/state/province
l_4 : district/county/city
l_5 : city/locale
l_6 : locale
Either value is not guaranteed and is provider-dependent.
set
This operation writes data to the cache.
Parameters:
lang : string
language code, en by default.
с_m, с_c, с_e, с_f, с_r, l_1, l_2, l_3, l_4, l_5, l_6 : strings
Geolocation data.
re : string or IP-Address
the end of a range relative to the ip-address parameter./dd>
full : string
if this parameter is present, the record will be considered full, and no requests will be made to the provider for the missing languages for this address/range.
To use this command, the user should have the "Server Settings" Server Administration right.
clear
This operation resets the contents of the cache and calls the geolocationinit.sppr application for initialization.
Parameters:
none
the value of the ip-address parameter is ignored
To use this command, the user should have the "Server Settings" Server Administration right.
print
This operation prints out the contents of the cache.
Parameters:
none
the value of the ip-address parameter is ignored
Results:
dictionary: the cache contents

CommuniGate Pro Guide. Copyright © 2020-2023, AO StalkerSoft