Additional analyze of calls
In some cases, receiving information about calls processed in Tariscope is not enough and additional data analysis is required, which we would like Tariscope to perform automatically. For example, a company's security service would like to promptly know about all calls made by employees from departmental PBX phones to the fire department, police, or ambulance. Another example is when it is desirable to know about all outgoing calls, the cost of which is above a certain amount, or about calls to (from) phones from the "blacklist". You can think of a whole range of other cases when it is necessary to promptly receive notifications about certain calls.
Of course, it would not be the best solution to such tasks to put an employee behind a monitor with Tariscope to monitor such calls. But this is not necessary if you use all the capabilities of Tariscope. Tariscope can be configured so that after each call it will automatically perform additional analysis of the call data for compliance with pre-set conditions, for example, as we mentioned earlier, the execution of a call to some specific phone numbers by any employee of the company.
A special case that requires operational tracking is the detection of telephone fraud. Telephone fraud refers to a certain type of fraud, when unauthorized calls, usually international, are made by various means at the expense of the company. In 2023, according to the international association CFCA (Communications Fraud Control Association), losses from telephone fraud will amount to about 38.95 billion US dollars [1].
Fraud detection is significantly more difficult than, for example, detecting calls to specific phone numbers, since it is not known in advance which numbers are called, when, and for how long. To detect fraud, it is usually recommended to use special systems, which in most cases are based on comparing a specific call with the behavior model of a specific subscriber, group of subscribers, and the company as a whole. Tariscope has such a fraud detection subsystem, but this subsystem is not included in the basic license for Tariscope and must be purchased in addition to the basic license.
At the same time, even without purchasing such a subsystem, Tariscope makes it possible to detect suspicious calls that may be fraudulent. In this article, we will consider how to do this.
First, we will consider only outgoing international calls costing more than a given amount, since fraud is much less common for long-distance and even more so for city calls.
Secondly, of the specified calls in the first condition, the most suspicious calls with signs of fraud should be considered those that are made during non-working hours, on weekends and holidays.
Thirdly, you can evaluate the countries where the call was made. It is believed that the largest number of fraudulent calls are made to countries in the Caribbean, as well as Asia and Africa.
And, finally, you can evaluate calls for fraud from subscribers whose data is not available in the Tariscope database.
Now let's look at how the search for calls with some of the above features can be implemented in the Tariscope system.
In the Tariscope Observer service settings, there is a feature to execute scenarios when certain events occur. To do this, in the Data Collection/Observer menu branch of the Tariscope system, select the Observer Management menu item. The Data Collection/Observer page appears, an example of which is shown in Figure 1.
Figure 1
Select the row of the required Observer, if you have several, and click on the Edit icon on the toolbar. In the menu that appears, select the Observers’ scripts item. As a result, the Observers’ scripts page appears, an example of which is shown in Figure 2.
Figure 2
This window contains a list of events, upon the occurrence of which Tariscope can launch the script associated with this event. Possible reaction to such events:
- Data source connected.
- Data source disconnected.
- Change class of service.
- Group state changed.
- Periodic action.
- New call.
- Database unavailable.
To analyze calls for fraud, select the New call event in the Event list, and select the file containing the fraud analysis script in the Script list. Scripts supplied with Tariscope are installed by default in the C:\ProgramData\Tariscope\ObserverScripts folder.
After selecting the desired scenario, save the settings (Figure 2).
Scripts must be written in C#. Among the scripts supplied with Tariscope is the fraud.cs file. It allows you to send a message either to the email address specified in the script or to the email address specified in the Tariscope settings, about outgoing international calls lasting more than 150 seconds, which are made in the time period: from 19:00 to 08:00 or on weekend. These parameters can be changed, deleted or added by the Tariscope administrator.
To write new scripts or edit existing ones, it is desirable to have an understanding of C# programming, as well as of creating SQL queries
If you are not confident in your abilities, contact SoftPI technical support, as an incorrectly written script can damage the Tariscope system. Script writing by SoftPI is not included in warranty or post-warranty support services and is performed for a separate fee.
The structure of all scripts used in Tariscope is the same. Each script implements the IScript interface.
There are two methods in this interface:
- Init method. This method is called once during script startup, when the Tariscope Observer service compiles and initializes this script.
- Main method. It performs operations related to a specific event. The Parameters object is passed to the Main method.
- When a script is initialized, it is passed the IScriptHost interface, which allows the script to perform some operations. For example, send an email message.
The fraud.cs script listing is below:
using Microsoft.Data.SqlClient;
using SoftPI.Tariscope.WebAdministration.Observer.Scripting.Interfaces;
using SoftPI.Tariscope.WebAdministration.Observer.Scripting.Models;
using System;
using SoftPi.Tariscope.DAL;
public class FraudScanner : IScript
{
private IScriptHost Host;
private bool NeedFinish = false;
//
//
********************************************************************************************
//
private int MAX_CALL_DURATION_S = 150;
private int CALLTYPE_INTERNATIONAL = 5;
private TimeSpan BEGINNING_OF_WORK = TimeSpan.Parse("08:00:00");
private TimeSpan END_OF_WORK = TimeSpan.Parse("19:00:00");
//
//
*********************************************************************************************
//
public void Init(IScriptHost host)
{
this.Host = host;
host.Close += OnClose;
NeedFinish = false;
}
private void OnClose(ref bool Cancel)
{
return;
}
public void Main(object Parameters)
{
NewCallActionParameters actionParameters = (NewCallActionParameters)Parameters;
try
{
this.Host.AddEvent("New call processing, ID= " + actionParameters.Id);
using (SqlConnection cn = new SqlConnection(this.Host.DatabaseConnectionString))
{
cn.Open();
CallItems CallItems = CallItems.Instance(cn);
SqlCommand cmd = CallItems.GetCommand("SELECT ID, Originator, Dialnumber,
CallDateTime, CallSeconds, CallType FROM viCalls WHERE ID=@callid>");
cmd.Parameters.AddWithValue("@callid", actionParameters.Id);
using (SqlDataReader rs = cmd.ExecuteReader())
{
if (rs.Read())
{
if (rs.GetInt16(5) == CALLTYPE_INTERNATIONAL &&
rs.GetInt32(4) > MAX_CALL_DURATION_S &&
(((rs.GetDateTime(3).TimeOfDay > END_OF_WORK ||
rs.GetDateTime(3).TimeOfDay < BEGINNING_OF_WORK)) ||
(rs.GetDateTime(3).DayOfWeek == DayOfWeek.Sunday ||
rs.GetDateTime(3).DayOfWeek == DayOfWeek.Saturday)))
this.Host.SendMail("", "Fraud Detection system", "Suspicious call detected. ID=" + actionParameters.Id + " CallDateTime=" + rs.GetDateTime(3) + " Call duration=" + rs.GetInt32(4));
}
}
}
}
catch (Exception ex)
{
this.Host.AddEvent("Error running script: " + ex.ToString());
}
}
}
For someone who is not familiar with programming, the above script code may seem completely incomprehensible. In fact, this is not entirely true. In the code, those lines that can be changed if necessary are highlighted in red.
Consider the first four highlighted lines:
private int MAX_CALL_DURATION_S = 150;
private int CALLTYPE_INTERNATIONAL = 5;
private TimeSpan BEGINNING_OF_WORK = TimeSpan.Parse("08:00:00");
private TimeSpan END_OF_WORK = TimeSpan.Parse("19:00:00");
These lines declare four variables:
- MAX_CALL_DURATION_S. This is the duration of the call, which is 150 seconds, or 2 minutes and 30 seconds. You can change this value to any positive integer or 0.
- CALLTYPE_INTERNATIONAL. This is the call type for international calls used in Tariscope. Its value is 5. If you are only going to consider international calls, do not change this value. If you are interested in other calls, you can determine their value from the document Tariscope 4.6. Database schema.
- BEGINNING_OF_WORK. This is the start time of the workday, which here is 8 a.m. You can change this value to any other real-world start time.
- END_OF_WORK. This is the end time of the workday, which here is 7 PM. You can change this value to any other real-world end time value.
The next highlighted line:
SELECT ID, Originator, Dialnumber, CallDateTime, CallSeconds, CallType FROM viCalls WHERE ID=@callid>
This is a SQL query to the viCalls view to retrieve from it the current call specified by the condition ID=@callid, where @callid is a parameter that contains the ID of the last call that was processed in the Observer. This SQL query allows you to retrieve the following fields:
- ID. Record ID.
- Originator. The phone number from which the call was made.
- Dialnumber. The phone number to which the call was made.
- CallDateTime. Date and time of the call.
- CallSeconds. Call duration in seconds.
- CallType. Call type.
If necessary, it is possible to obtain other call parameters from the list of viCall view fields.
The following highlighted part of the script analyzes the data for compliance with the specified conditions:
(rs.GetInt16(5) == CALLTYPE_INTERNATIONAL &&
rs.GetInt32(4) > MAX_CALL_DURATION_S &&
(((rs.GetDateTime(3).TimeOfDay > END_OF_WORK ||
rs.GetDateTime(3).TimeOfDay < BEGINNING_OF_WORK)) ||
(rs.GetDateTime(3).DayOfWeek == DayOfWeek.Sunday ||
rs.GetDateTime(3).DayOfWeek == DayOfWeek.Saturday)))
This code is used in the if statement as a condition for matching data. It consists of the following conditions:
rs.GetInt16(5) = CALLTYPE_INTERNATIONAL
The value of the 5th field of the query is taken (this is the CallType field in the SQL query). The field count starts from 0. The field value is compared with the value of the CALLTYPE_INTERNATIONAL variable. That is, this condition allows you to detect whether this call is international.
rs.GetInt32(4) > MAX_CALL_DURATION_S
The value of the 4th field of the SQL query (the CallSeconds field) is taken. The value count starts from 0. The field value is compared with the value of the MAX_CALL_DURATION_S variable.
(rs.GetDateTime(3).TimeOfDay > END_OF_WORK ||
rs.GetDateTime(3).TimeOfDay < BEGINNING_OF_WORK))
This condition uses the value of the 3rd query field, the CallDateTime field. It checks whether the call time falls between the end of a business day and the beginning of the next business day.
(rs.GetDateTime(3).DayOfWeek == DayOfWeek.Sunday ||
rs.GetDateTime(3).DayOfWeek == DayOfWeek.Saturday)
This is an alternative call time condition that all international calls longer than 150 seconds that are made on Saturday or Sunday must meet.
Using the logical operators && and ||, you can consider the call's compliance with the required conditions differently.
If the result of the check is true, then the command to send an email notification about this call is executed.
this.Host.SendMail("", "Fraud Detection system", "Suspicious call detected. ID=" + actionParameters.Id + " CallDateTime=" + rs.GetDateTime(3) + " Call duration=" + rs.GetInt32(4));
this.Host.SendMail() – This is a function that sends an email message. This function has three parameters, which are enclosed in parentheses and separated by commas:
- The first parameter specifies the email address to which the message is sent. If this parameter is empty (""), as indicated in the above expression, then the email address specified on the Notification and mailing setting page is used. If you want to send messages to a different address than the one specified on this settings page or you have not configured this parameter in Tariscope, then you should specify this address in quotes, for example, "This email address is being protected from spambots. You need JavaScript enabled to view it.".
- The second parameter is the subject of email. In this scenario, this parameter is "Fraud Detection system". If desired, you can replace this parameter with, for example, "Received a call with signs of fraud" or some other.
- The third parameter is the content of the message text. In this scenario, it is:
"Suspicious call detected. ID=" + actionParameters.Id + " CallDateTime=" + rs.GetDateTime(3) + " Call duration=" + rs.GetInt32(4) .
You can change the text of this line.
The SQL query line discussed above contains a request for two more parameters: Originator and Dialnumber. Accordingly, their values can also be displayed in the body of the email. To do this, add the following line:
“ The call was made from ” & rs.GetInt32(1) “ to telephone number “ & rs.GetInt32(2)
If you modify the SQL query, then in the message it is possible to display information about the subscriber from whose number the call was made, the name of the settlement where the call was made, and other information.
Now let's return to our conditions for detecting calls that can be suspected of being fraudulent. First, let's add an analysis of the call cost. To do this, in the place of the script where the variables discussed above were set, we will add the variable MAX_CALL_COST, for which we will set the value of the call cost, starting from which the call can be considered suspicious. For example, let it be a value of 5.0 USD. That is, the script should react to any call whose cost is more than 5.0 USD.
private decimal MAX_CALL_COST = 5.0;
Now you need to modify the SQL query to get information about the cost of the call. To do this, use the description of the viCalls view in the document of Tariscope 4.x. Database schema to find the required field. This is the Cost field. Then the query should look like this:
SELECT ID, Originator, Dialnumber, CallDateTime, CallSeconds, CallType, Cost FROM viCalls WHERE ID=@callid>
If we are not interested in the duration of the call, then we can exclude the CallSeconds field from the query. And now, having received the data on the call using this SQL query, we should analyze it for compliance with the conditions that interest us: an international call with a cost of more than 10 hryvnias. To do this, the line where the analysis is performed should be written as follows:
(rs.GetInt16(5) = CALLTYPE_INTERNATIONAL &&
rs.GetInt32(4)> MAX_CALL_DURATION_S &&
rs.GetDecimal(6) > 5.0) &&
(((rs.GetDateTime(3).TimeOfDay > END_OF_WORK ||
rs.GetDateTime(3).TimeOfDay < BEGINNING_OF_WORK)) ||
(rs.GetDateTime(3).DayOfWeek == DayOfWeek.Sunday ||
rs.GetDateTime(3).DayOfWeek == DayOfWeek.Saturday))
This line assumes that the CallSeconds field query remains. If it is removed, the value in parentheses in the data analysis line will change, indicating the field number in the query, starting from 0.
Similarly, you can further complicate the conditions for detecting fraudulent calls.
When using scripts for additional call data processing, you should always remember that this use increases the load on the server and can lead to slower processing.
In addition, if call data arrives in Tariscope with a delay, for example, when received via an FTP server, then suspicious call messages will also be generated with a delay.
If the above information is not enough for you to create the necessary script, please contact SoftPI technical support.
Links
Working with SBC 1000 and SBC 2000 gateways in Tariscope
The ability to collect and process CDR information from the SBC 1000 and SBC 2000 gateways from the Ribbon Communications company has been added to the Tariscope billing system.
These gateways transmit CDR data only to the Radius accounting server. Therefore, a new data source, the Radius accounting server, was added to the Tariscope Observer service. Data packets transmitted to the Radius accounting server are of two types: Start and Stop. Generalized information about the completed call is contained only in Stop packets, therefore only their processing is performed in Tariscope. Both Start and Stop packets are generated in the SBC for each call participant. Only one Stop packet is processed to avoid data duplication in the Tariscope system.
Next, we will present the Tariscope configuration features that are specifically related to the SBC 1000 and SBC 2000 gateways.
First of all, you need to create a suitable telephone system in Tariscope. To do this, select from the menu: Communication nodes → your node → Equipment → Equipment management. The Equipment page appears, an example of which is shown in Figure 1.
Figure 1
Click the Add icon on the toolbar. In the New equipment window that appears, enter any name. We recommend that you enter a name that matches the phone system, for example, SBC 1000. Click Save. The Edit page shown in Figure 2 will appear.
Figure 2
In the Equipment list, select the Ribbon SBC 1000, 2000 item. For these gateways, no further settings for CDR processing are required.
Just add the necessary parameters in the Codes and location section and click Save.
For the correct tariffication of calls, you must perform settings on the pages: Numbering plan and Routes and gateways, as well as add subscribers of this telephone system.
And finally, you need to create a Tariscope Observer service that will receive CDR data from SBC gateways and process this data.
Select Data collection/Observer → Observers management from the menu. The corresponding page will appear, where on the toolbar click Add → New Observer. A corresponding window will appear where you can enter the name of the Observer profile. For example, it could be: SBC 1000. Click Save. A window will appear confirming the creation of a new Observer profile, click on the Settings button. The Tariscope Observer configuration page will be displayed, an example of which is shown in Figure 3.
Figure 3
The Equipment item is "not selected", which means that you must specify the telephone system from the previously created ones for which this Observer is intended. Click on the "here" link and select the desired network and phone system.
In the Data source list, select Radius accounting server. Click on the Data source configuration button to the right of the Data Source list. The Data source configuration window will appear, an example of which is shown in Figure 4.
Figure 4
In the Port textbox, enter the IP port on which the Radius accounting server will work. By default, the port for this server is 1813. If you have multiple phone systems that need to transmit CDR data to Tariscope through the Radius accounting server, use port 1813 for the first Radius accounting server, and other IP ports for the other Radius servers, which free on your system.
In the Shared secret textbox, enter the value of the shared secret. The same value should be in the settings of the telephone system that will transmit CDR data.
Click Done.
This concludes the settings that are specific to the SBC 1000 and 2000 gateways. Perform all other settings in Tariscope according to the recommendations given in the Tariscope 4.6 document. Administrator's Guide.
Working with new Tariscope API methods
Any self-written application or third-party application that is designed for this purpose can be used to test the Tariscope API functionality. The Postman application was used for testing in this article.
To work with the Tariscope API, first, you need to create a suitable user and grant him rights to all or individual API methods.
To create a API user, in the Tariscope menu, select Advanced options → Integrations. Click on the Tariscope API button. The corresponding page will appear.
Click on API users. Click on the Add icon on the toolbar.
The New API user window appears, where you need to enter the required parameters and click on the Save button.
In the list of API users, select the one you created and click on the Method rights icon. The Claims setup for user page will appear, an example of which is shown in Figure 1.
Figure 1
The figure highlights the methods that were added in Tariscope version 4.6.4. These methods have the following purpose:
- accounts.charges. This is a GET method that allows you to get all charges of a specific subscriber for the specified period.
- accounts.payment. This is a POST method that allows you to enter information about payments from the subscriber for the provided communication services into the Tariscope database.
- accounts.payments. This is a GET method that allows you to get information from the Tariscope database about payments from a specific subscriber for a given period.
- subscriber.create. This is a POST method that allows you to create a new subscriber without a list of phone numbers (DNs) that belong to him. The following method should be used to add phone numbers (DNs).
- subscriber.dnadd. This is the POST method that allows to add a phone number (DN) for the subscriber.
Work with the Tariscope API must begin with the authorization of the API user in the system, which is performed using the api.auth method. As a result of the execution of this method, you should receive a token that must be used when executing all other API methods. The token is valid for 6 hours. After that you should get a new token.
1. Receiving the token
To perform any API method, you should authorize in the system. Execute the /api/auth method.
As mentioned above, working with the Tariscope API methods will be demonstrated using the Postman program.
Select the Post method and enter a request to connect to the computer where Tariscope is installed (Figure 2).
Figure 2
An example of the request:
http://localhost:7000/api/auth
localhost is used only if the application from which the API request is executed is on the same server as the Tariscope software. Otherwise, use the IP address of the Tariscope server.
7000 is the IP port on which Tariscope is running. By default, when installing Tariscope, IP port of 8085 is used.
/api/auth is a method for authorization in the system.
Before sending a request, you should select the row value in the Body tab of the request, set the JSON format and enter the username and password in this format.
On the Authorization tab, select Bearer token.
After that, click on the Send button. If all parameters are set correctly, you will receive a response in JSON format, from where you should copy the token.
To execute all other Tariscope API methods, this token should be inserted on the Authorization tab in the Token textbox. We remind you once again that the token is valid for 6 hours.
2. Receiving subscriber's charges
Receipt of charges is performed using the GET method /api/accounts/charges
Method parameters:
- id – subscriber ID in the Tariscope system.
- fromdate – the date from which the charge should be received. The date is set in the format: yyyy-MM-dd, for example: 2023-05-01.
- todate – the date by which the charge must be received. The date is set in the format: yyyy-MM-dd, for example: 2023-05-31.
For example, we are interested in the billing of a subscriber with ID 6169 for May 2023. That is, in this case we have:
id = 6169, fromdate = 2023-05-01, todate = 2023-05-31. Accordingly, we set the GET request:
http://localhost:8085/api/accounts/charges/?id=6169&fromdate=2023-05-01&todate=2023-05-31
An example of such a request in the Postman program is shown in Figure 3. It should not be forgotten that, as in the previous request, the user's API name and password should be specified in its body.
If all parameters are specified correctly, Tariscope will return information about the subscriber's billing.
Figure 3
List of parameters for each calculation:
- id – subscriber ID in the Tariscope system.
- recdate – date of entry of charge in Tariscope.
- fromdate – the start date of the service billing period.
- todate – the date of the end of the service billing period.
- servicename – service name.
- charge – charged amount.
- numberofservices – the number of charged services. For calls, this is the number of seconds.
An example of the server's response is shown in Figure 4.
Figure 4
If the query is specified incorrectly, or the query parameters are incorrectly specified, Tariscope returns a message about this. An example of this is shown in Figure 5.
Figure 5
3. Entering payment information in Tariscope
Entering payment information from the subscriber is performed by a POST request: /api/accounts/payment
Parameters of the POST request to the Tariscope system:
- id – subscriber ID in the Tariscope system.
- paymentday – payment execution date in the format: yyyy-MM-dd.
- payment – amount of payment for communication services.
- paymenttype – type of payment (not specified – 0, cash – 1, by receipt – 2, by account – 3).
- bank – the bank through which the payment was made.
Example.
The subscriber with the identifier of 6193 paid for communication services in the amount of USD 370.00 on 05/17/2023 on account through XXXBank. This means: id=6193, paymentday=2023-05-17, payment=370.00, paymenttype=3, bank=XXXBank
The POST request will be as follows:
http://localhost:8085/api/accounts/payment/?id=6193&paymentday=2023-05-17&payment=370.00&paymenttype=3&bank=XXXBank
If the query parameters are correct, Tariscope will return the following data:
- subscriberid – subscriber ID in the Tariscope system.
- paymentid – payment record identifier.
- paymentday – date of payment in the format: yyyy-MM-dd.
An example of the answer is shown in Figure 6.
Figure 6
4. Receiving information on subscriber payments for the period
Obtaining such information is performed with a GET request: /api/accounts/payments
This request has the following parameters:
- id – subscriber ID in the Tariscope system.
- fromdate – the date from which payments are to be received. The date is set in the format: yyyy-MM-dd, for example: 2023-05-01.
- todate – the date by which payments are to be received. The date is set in the format: yyyy-MM-dd, for example: 2023-05-31.
- paymentid – payment record identifier. If this identifier is specified in the request, then the dates are ignored, and the presence of such a record in the Tariscope database is checked. If this identifier = 0, then the ARI must return all payments for the specified period.
Example.
Get information about payments from the subscriber with the identifier 6169 for the period from 04/01/2023 to 05/31/2023. This means that the following parameters must be set: id=6169, fromdate=2023-04-01, todate=2023-05-31, paymenеtid=0
That is, the entire GET request will be as follows:
http://localhost:8085/api/accounts/payments/?id=6169&fromdate=2023-04-01&todate=2023-05-31&paymenеtid=0
If all parameters are specified correctly, Tariscope will return the following data:
- subscriberid – subscriber ID in the Tariscope system.
- paymentid – payment record identifier.
- paymentday – date of payment in the format: yyyy-MM-dd.
- payment – payment amount.
An example of the result of executing such a request is shown in Figure 7.
Figure 7
5. Creating a new subscriber
Creating a new subscriber is done using a POST request: /api/subscriber/create
This request has the following parameters:
- fullname – full name of a legal entity, individual, or employee of a communications operator.
- departmentid – ID of the group to which the subscriber belongs. If the subscribers are not divided into groups, then they belong to the root group, which has the same name as the communication node.
- subscribertype – subscriber type: 0 - individual, 1 - legal entity, 2 - official, 3 - budget, 4 - preferential.
- connectiondate - date from which the subscriber is considered connected in the format: yyyy-MM-dd.
- contactnumber – contract number with the subscriber.
- contractdate - contract date in the format: yyyy-MM-dd.
- accountnumber - subscriber's personal account number, if it is not created automatically in Tariscope.
- personalcode – individual tax number for individuals.
- edrpou – legal entity code.
- taxcode – tax code for legal entity.
- bankcode – bank code for legal entities.
- bankname - name of bank.
- bankaccount – bank account number.
- rateplanid – identifier of the rate plan assigned to the subscriber.
Example.
Create a subscriber, a legal entity with the name of JSC ABC, its code is 55667788, a tax code is 123456789, with a date of connection from 02.06.2023, with which a contract for the provision of communication services under the number 247-23 dated 01.06.2023 was concluded. This company is served by XXXBank, the bank code is 325365, the bank account is UA125438790123456. This subscriber will be served with the “Basic” rate plan, which has the identifier 43 in Tariscope. The subscriber belongs to the group of subscribers with the identifier of 419. The personal account of8640-fo should be assigned to the subscriber
For these parameters, the following POST request must be performed:
http://localhost:8085/api/subscriber/create/?fullname=JSC ABC&departmentid=419&subscribertype=1&connectiondate=2023-06-02&contractnumber=247-23&contractdate=2023-06-01&accountnumber=8640-fo&personalcode=&edrpou=55667788&taxcode=&bankcode=361234&bankname=XXXBank&bankaccount=UA125438790123456&rateplanid=43
With the correct settings, Tariscope returns the following information:
- id – subscriber ID in the system.
- accountnumber - subscriber's personal account number. If it is generated automatically in Tariscope, it will match the id.
- fullname – full name of a legal entity, an individual, or an employee of the telecommunications provider.
An example of information received from Tariscope for this request is shown in Figure 8.
Figure 8
6. Adding a phone number to the subscriber
To add a phone number to a subscriber, you need to perform a POST request: /api/subscriber/dnadd
This request has the following parameters:
- SubscriberId. Subscriber ID to which the phone number is assigned.
- DN. The phone number assigned to the subscriber.
- description. Description to the phone number. Optional parameter.
- fromdate. The date from which this number belongs to the subscriber.
- pbxid. The identifier of the PBX to which the telephone number belongs.
Example.
The subscriber with the identifier 7334 must be assigned the telephone number 2001 from 02.06.2023. The number belongs to the PBX with identifier 292.
The following POST request should be created for these parameters:
http://localhost:8085/api/subscriber/dnadd/?SubscriberId=7334&DN=2001&description=&fromdate=2023-06-02&pbxid=292
If the request parameters are specified correctly, Tariscope will return the following information:
- id. Phone number identifier in Tariscope.
- subscriberid. Subscriber ID to which the phone number is assigned.
- pbxid. The identifier of the PBX to which the telephone number belongs.
- dn. Phone number.
An example of obtaining information about adding a number is shown in Figure 9.
Figure 9
Configuring Tariscope Observer
The Tariscope Observer service (or simply Observer), which is one of the Tariscope applications, is intended for automatic collection of information about completed calls (CDR, SMDR, AMA and others) from the PBX or from files located in some folder, initial processing of this data, and also for executing scripts for individual events.
That is, the Observer is the link that connects the telephone system with the Tariscope system. One Observer is designed to interact with one telephone system (PBX). Tariscope has no limit on the number of Observers it can receive information from. Observer can be configured to receive CDR information from various types of data sources, which are mentioned below. The choice of data source type primarily depends on the type of telephone system from which the CDR data is received.
Observers can be located both on the same server where the Tariscope system is located, and on a remote computer (server) that has a connection with the Tariscope server via an IP network. Any Observer, local or remote, must have IP communication with the Tariscope server (the TS.MAIN service) and the Microsoft SQL Server (hereinafter “SQL Server”) on which the Tariscope database is installed. When the Observer starts, it contacts the Tariscope server, receives a database connection string from it, and then connects to the Tariscope database. If you have a firewall or other security systems, you must configure them that Observer will have IP access to Tariscope server (IP port: 8001) and SQL server (IP port: 1433, 1434).
An Observer can react to the following events by executing a specific script:
- Data source connected.
- Data source disconnected.
- Change class of service. This event is only relevant if the Tariscope license includes the restriction feature for subscribers.
- Group state change. This event is only relevant if the Tariscope license includes the restriction feature for group of subscribers.
- Periodic action.
- New call. The script for this event allows you to perform some additional data processing on information about the received call. For example, you can check whether the dialed number does not belong to a specific group of phone numbers.
- Database unavailable. This event may be relevant if Observer and Microsoft SQL Server are on different servers. If you lose connection to the database, a script can send a message to the administrator.
Regardless of whether you are configuring local or remote Observers, you need to configure them in the Tariscope application. These settings are the same for both types of Observers. In the future, we will consider the features of remote Observer customization
In the Tariscope menu, choose: Data collection/Observer → Observer management. A page appears, an example of which is shown in Figure 1.
Figure 1
Let's create a new Observer. Click the Add icon on the toolbar. A menu appears, select the New Observer item. The window shown in Figure 2 will appear.
Figure 2
In the Name box, enter the name of the Observer profile. We recommend naming the profile with the name of the telephone system from which this Observer will receive data. For example, you need to receive data from CUCM (Cisco). In this case, it is better to name the profile: CUCM. The name must not contain any characters other than letters and numbers. Click Save. A window will be displayed to confirm the creation of the profile (Figure 3).
Figure 3
Click Settings. The Tariscope Observer configuration page appears, an example of which is shown in Figure 4.
Figure 4
Click on the 'here' link and select an existing phone system. For our example, it should be CUCM.
In the Data source list, select the appropriate source. For our example, if CUCM is configured as an FTP client, the data source should be an FTP server. For other types of telephone systems, data sources can be: FTP client, TCP client or server, local or remote folder, and others, depending on how the telephone system provides CDR data. To configure the data source parameters, click on the button to the right of the Data source list and perform the settings. See the documentation for a description of setting up a specific data source.
The Storage of processed CDRs box is intended to select a folder to store the raw CDR data that is received from the telephone system. This data can be used if it is necessary to completely reprocess call data. By default, they are stored in the C:\ProgramData\Tariscope folder. CDR logs have the extension CDR, and the file name includes the name of the Observer's profile and the date.
In the Creation period list, select the period for creating logs with primary CDR data. The period of creation depends on the call traffic. If it is higher, the better to choose a shorter period. One month is offered as a default period.
In the Log level list, select the level of detail for the Observer profile log. The least detailed level is Status, the most detailed level is Debug.
This concludes the debugging of the local Observer. If you are configuring a Remote Observer, enable the Remote observers switch.
Click the Save button. The Data Collection/Observer page will look similar to the one shown in Figure 5.
Figure 5
If you have created a local Observer, you can start it by clicking on the Control icon and selecting Start.
In the case when you configured a profile for a remote Observer, perform the following actions.
Work on a remote server
Before making settings on a remote server, you should:
- Perform the settings indicated above on the Tariscope server.
- If a firewall is running on the Tariscope server, add rules that will allow access to the IP ports: 8001 (Tariscope server is running on it), 1433, 1434 (SQL server ports).
- Verify that the server where Tariscope was installed is reachable over the network from the remote server where Remote Observer is installed.
Install Tariscope on the remote server (computer). http://www.tariscope.com/en/88-support_en/tariscope-4-6-administrator-en/1458-installation-4-6-en.html#:~:text=1.1%20Installation%20for%20Windows
When performing the installation for Windows, in the Tariscope components stage (Figure 1.1.5 in the article at the link above), select the Observer Server. By default, the installation is performed in the folder: C:\Program Files (x86)\SoftPI\Tariscope
To run a remote Observer, you must know:
- IP address of the server where the Tariscope server is installed. For example, the IP address of the Tariscope server is 10.10.0.148.
- The name of the profile that was created there specifically for this Observer. In our example, it is: CUCM.
Open Command Prompt with Windows administrator rights. Run the following commands there.
Go to the software folders. If you installed to the default folder, this will be the command:
cd C:\Program files (x86)\SoftPI\Tariscope\Microservices
Next, start the remote Observer, specify the name of the profile (the name parameter) and the URL of the Tariscope server (the main parameter) as its parameters. An example of such a command is given below:
.\Tariscope.Observer.exe /name=CUCM /main=”http://10.10.0.148:8001”
In this example, the name of the profile is CUCM and the URL of the Tariscope server is http://10.10.0.148:8001 , where 10.10.0.148 is the IP address of the server and 8001 is the IP port on which the server is running.
An example of such data entry is shown in Figure 6.
Figure 6
If all the settings are made correctly and the network provides access from the remote Observer to the Tariscope server, then the Observer will be connected to Tariscope and SQL Server.
You can check the result of connecting Observer in its log. Observer logs, both local and remote, are kept in the C:\ProgramData\Tariscope\Logs\Observer folder on the Tariscope server or on the remote server, respectively. The log is named [Profile Name].log. For our example, this will be the file: CUCM.log
This log is generated only after the remote Observer has successfully connected to the Tariscope server. If there is no log, it means that the connection failed.
An example of the log is shown in Figure 7.
Figure 7
You can also check the connection of the remote Observer to Tariscope in Tariscope on the Observers page (Figure 8).
Figure 8
As you can see in the figure, the Service status column displays the value Online.
You must leave the Command Prompt window open with the Remote Observer running. Closing the Command Prompt will terminate Observer. And to restart it, you will need to load the Command Prompt again and repeat the above commands.
To create other remote Observers, you need to repeat all the above actions: create a profile in Tariscope, launch a remote Observer with the appropriate profile name.
You can run remote Tariscope Observers as Windows services. For this, you can use, for example, the third-party program: nssm (https://nssm.cc/).
To create a remote Observer service, run the nssm program with the following command:
nssm install TS.Observer,
where TS.Observer is the name of the service being created. If you create multiple services, they must have different names. As a result of executing the command, the window appears as shown in Figure 9.
Figure 9
In the Path box, enter the path to the Observer file:
C:\Program files (x86)\SoftPI\Tariscope\Microservices\Tariscope.Observer.exe
In the Arguments box, enter the Observer parameters: the name of the profile and the URL of the Tariscope server. For our example it will be:
/name=CUCM /main=http://10.10.0.148:8001
Click Install service.
A corresponding Windows service will be created, which must be started from the Windows Services window.
Import of codes and rates in Tariscope
If you are a user of Tariscope Enterprise or Tariscope Provider and you are interested in the cost of calls that were made by your telephone systems subscribers (customers), then you must add rate (tariff) data into the Tariscope database.
If your PBX is connected to Public Switched Data Network (PSDN) through one telecommunications service provider (TSP), then all calls will be rated at the rates of this TSP. If the PBX has a connection with different TSP, then a call for the same destinations will depend on which the TSP was made through. Therefore, Tariscope rates are tied to a specific TSP.
For Tariscope Provider users, which are a TSP themselves, it should also be borne in mind that you may have different rate plans that are assigned to customers, so customers with different rate plans may have different call costs with the same duration. To fulfill this, the cost of a specific rate should be attached to the rate plan.
In order for Tariscope to know what the rate will use to calculate the cost of a specific call, it detects a telephone code in the dialed number and finds the rate that corresponding to this code. Therefore, the rate should be tied to a specific phone code. Of course, one rate can be tied to many phone codes.
Tariscope contains data on several TSPs. Therefore, you can choose any of these TSPs or create a new TSP based on the existing one and then to change a list of rates, their cost and tie to specific telephone codes.
In addition, you can also create a new TSP, create a list of rates and tie these rates to phone codes.
Finally, rates and telephone codes can be imported from external files. It is this option that we will look at this article.
So, to import rates and codes into the Tariscope system you must have a file of one of the following formats:
- Microsoft Excel 2007 (.xlsx).
- Microsoft Excel 2003 (.xls).
- Microsoft Access (.mdb).
- Microsoft Access 2007 (.accdb).
- Comma separated (.csv).
Excel format files are usually used. Therefore, we will consider importing from this file format. But the import for other formats is no different.
Let's list the minimum necessary fields for importing telephone codes and rates:
- Name for phone code and rate.. This is usually the name of a country or city, or a mobile operator.
- Phone code or codes.. If several codes are specified, they must be separated by commas.
- Rate cost.
- Date.. The date from which the rate is valid. If the date is missing, the current date which was set on the computer will be substituted during import.
Additionally, other fields can be specified, which we will mention later.
An example of an Excel file for importing codes and rates is shown in Figure 1.
Figure 1
In it, column A contains the name for the code and rate, column B contains the rate value in dollars, column C contains telephone codes, column D contains the date from which the rate is effective, and column E contains a code correcponds to the call type in Tariscope. There are the following codes in Tariscope:
3- in city;
4 - long distance;
5 - international;
6 - mobile.
Before starting the import, you must have a rate plan to which rates will be imported.
Let's create a new telecommunication service provider and import data from an Excel file into it.
To create a new TSP, select Providers and rates → Provider management in the menu. The Providers page will appear, an example of which is shown in Figure 2.
Figure 2
Click the Add icon on the toolbar. The New provider window appears, where in the Name box, enter the name of TSP. We will create the TSP that is a name of Test 001. If you need to add comments to this name, enter it in the Description position. Click Save. A new row appears on the Providers page.
After that, go to the Common phone codes page, an example of which is shown in Figure 3.
Figure 3
Click the Import Wizard icon on the toolbar. The Import Wizard page appears, an example of which is shown in Figure 4.
Figure 4
Click on the Start button. As a result, the page will take the form shown in Figure 5.
Figure 5
In the File Type list, select your file type with codes and rates. Click the Choose button and select this file. Then click Next.
If you have chosen an Excel file, the next step (Figure 6) will allow you to select the worksheet that contains the necessary data in this file in the Available Tables list.
Figure 6
Click Next and the Import Wizard page appears as shown in Figure 7.
Figure 7
In this import step, the user must associate the Tariscope database fields with the column names of the file being imported from. To quickly identify the columns of the file, they are displayed at the bottom of the page.
In the Code list, select the column that contains the telephone code or codes. In the given example, this is the column named Numbering plan.
The Name list is used for the name of the settlement or mobile operator to which the telephone codes belong. In the given example, this is the column named Destination.
In the Rate name list, in most cases, you should choose the same value as in the previous one. For our example, this is the column named Destination.
In the Rate list, select the column that contains the price of the rate. For our example, this is a column with the new Rates in USD per minute.
If the import file has a column that contains information about the type of call: international, long distance, mobile, and other, then select that column in the Call Type list. This is an optional parameter.
Any telephone code can be linked to a pre-created call category. The presence of a category can allow you to filter calls by them, create special reports, and also set restrictions for subscribers, if the Tariscope license includes a restriction function. To set a category for a phone code, select it in the Category list. This is an optional parameter. The example file does not have a corresponding column.
In the From date list, select the column with the date from which the telephone code becomes effective. In the given example, this is the Effective Date column. If there is no such column in the import file, the current date will be set as the effective date of the phone code during import.
If the import file contains a column with the date until which the telephone code is valid, then select this column in the To date list. This is an optional parameter.
Tariscope can charge for both outgoing and incoming calls. Separate rates are used for each of them. Accordingly, you must choose for which type of calls the tariffs will be imported: for outgoing (in the import file the value must be 0) or incoming (in the import file must be the value 1). If there is no such field in the file, then do not select anything in the Rate direction item. In this case, outgoing calls will be understood.
In the From date (rate) list, select the column with the date from which the rate starts. In the given example, this is the Effective Date column. If there is no such column in the import file, the current date will be set as the effective date of the rate during import.
Thus, for our example, the selection should be made as shown in Figure 8.
Figure 8
Click Next. The wizard page will take the form shown in Figure 9.
Figure 9
These are the final import settings.
If you need to import both telephone codes and rates, the Import only codes switch should be disabled.
In the Provider list, you should select the operator to which rates will be imported. We created the test5 provider, which we selected.
In the Default rate plan list, select the one to which the rate costs will apply.
In the Currency item, select the one in which the rates are specified in the import file. In our file, it is USD.
If you are a TSP and you use Tariscope Provider, and you want calls for all tariffs that will be created to be charged to the subscriber's personal account per month under one name, for example, "International calls", then enter this name in the Description for accounts textbox.
If it is necessary that the tariffing should be carried out with an accuracy of seconds, then the Rounding to minutes switch should be turned off.
The Update rates switch is relevant when you update data on previously entered rates. In this case, you should enable this switch. If it is disabled, then only new telephone codes and their rates, which are in the import file, will be added.
Click Import.
After the import is finished, information about the number of added telephone codes and rates appears.
If you update rates for telephone codes already existing in the database, these codes will not be added again.
If you return to the tariff page of the specific provider for which the data was imported, and select the appropriate rate plan there, you will see all the imported rates (Figure 10).
Figure 10
Only importing codes and rates into the Tariscope system is not enough for the correct charging of calls. There are still some settings that need to be done. There is a separate article about these settings. Let's note only what is related to the codes and the rates of a specific operator. This provider must be tied to routes (groups of communication lines), gateways of the telephone system.
In the case when you have just created a new provider and you did something wrong when importing the codes and rates, you can simply delete this provider and then create it again. To do this, use the Providers page (Figure 2).
If you are a telecommunications service provider and you have several rate plans in which the cost of rates is different, which is a certain percentage of the cost of the main rate plan, then you can easily create additional columns for these rate plans in your Excel file. And then you should repeat the rate import for these rate plans.
There is one more feature for users of the Tariscope Provider edition to be aware of. When importing rates, a separate rate is created for each telephone code or group of telephone codes that are specified in one line. When processing information about calls in the table of personal accounts of subscribers, a separate record will be created for the reporting period for each rate, and all calls for this rate will be summarized in one record. For example, if the subscriber made calls to 20 countries during the month, then 20 entries will be created in the personal account of this subscriber. In most cases, it is not necessary, but one record, for example, with the International calls name, which would combine the charges for all international calls, is enough. There is a setting in rates that allows you to combine all charges for calls of a certain type with different rates in one personal account record. For this, the Description box on the Accounts tab of a specific rate is used (Figure 11). That is, if in all rates related to calls to other countries, enter, for example, the name of International calls in this box, then all charges for calls abroad during the month will be charged to one record.
Figure 11
You can add such a description at the same time for a group of rates if you enable the Show all entered dates and Multiselect switches on the Rates page (Figure 12).
Figure 12
The necessary lines are selected by clicking on the required lines of the rate table.
But with a large number of rates, their selection can take a long time. Therefore, we suggest using SQL query execution. Let's say we want to set the International calls name to personal accounts for all rates starting January 1, 2022.
To do this, select Additional options → SQL queries in the menu, where you should enter the following query:
UPDATE TarifSettings SET AccountsDescription = 'International calls' WHERE RecDate = '20220101'
In this query, change the date 01/01/2022 ('20220101') to the date you want and the value of 'International calls' to the name you want.
Click the Run icon on the toolbar. After that, all calls that will be processed according to these rates will be charged to one record with the name ‘International calls’.
Here are a few more SQL queries that may come in handy.
Change of rate date.
For example, it is necessary to change the effective date of all rates to 01.02.2022, which currently have a date of 01.01.2022. To do this, the following query should be executed on the SQL query page:
UPDATE TarifSettings SET RecDate = '20220201' WHERE RecDate = '20220101'
Deleting rates for a specific date .
For example, you need to delete all tariffs effective from 01.02.2022. To do this, you should execute the following query:
DELETE FROM TarifSettings WHERE RecDate = '20220201'
Related articles
1. Telecommunications service providers.
2. Configuration of call rating in Tariscope.
3. Rate plans.
Subcategories
How to configure
This category contains articles that were not included in Administrator's Guide and that describes how to configure a specific Tariscope feature