Semiautomatic saving of the localization settings in ASTPP

by Emin Gabrielyan on 2021-04-08, on 2021-04-08

 

Table of Contents

Problem.. 1

Bypass. 1

Disadvantages. 1

Update. 1

END.. 1

 

 

Problem

When uploading new customers into ASTPP billing there seems no possibility is foreseen for setting the local dialing rules. The local dialing rules can be set individually for each customer manually, via the administrator interface.

Bypass

Here I suggest a bypass, like the bypass for uploading the payments [doc].

Provided is an html file:

1.html

2.txt

3.zip

In the beginning of the file, you must insert your records in the following format. The examples shown here can be used on the test server (the passwords and the accounts do not correspond to the passwords of real users).

[167, "41993307798", "1lZoMh8P", "mici@mi.mi", 1, "milica0", 185, 28, 131, 5],

[166, "41193451632", "gDW8IDta", "elena@el.el", 1, "elena0", 185, 28, 131, 5],

[65, "41760244629", "t6iZEhZ8", "ne@ne.ne", 1, "neeee0", 185, 28, 131, 5],

[165, "4141582488916", "0001122uuz", "y.s@g.com", 1, "Yevgeniya0", 185, 28, 131, 7],

 

These fields are those which are obligatory, otherwise the billing does not accept the post submission:

id (the user id in the database)

number (the SIP account),

password,

email,

localization_id (the entry created for the dialing rules),

first_name,

country_id,

timezone_id,

currency_id,

pricelist_id (the identification of the product created or rate group).

 

In order to make sure that you are authenticated, use the first three buttons to be sure that your changes are taking effect:

load()

clean()

submit()

The above mentioned do not increment the counter. When you see that it works and if you want to start uploading by incrementing the counter, use the two other buttons.

saveone()

saveall()

These buttons will upload a record and move the pointer to the next position.

At the bottom of the page, you have a text in the following format:

Saved 0 of 10 of total 16 records.

The first number (which is 0 in the above example) is the index of the record that will be sent the next (or, which is the same, the number of records already sent). If you have 16 records, the record indices go from 0 to 15. You can change this value and load the record by clicking on the load() button in order to inspect your records. I recommend you experimenting with this to see how it works.

The last number (which is 16 in the above example) is the total number of records that you inserted into the file.

The second number (10 in the above example) is the limit that you will change yourself. Here is a scenario how you can use that field. If you must upload 100 records, you may need to fix this value to a smaller number, such as 10. The script will upload the first 10 records and will stop. If you wait long enough, the system will log you out. Now you can increment the limit from 10 to 30. Before continuing, you must login using the first three buttons (if you use the last two buttons, the script will increment the counter, without realizing that the actual uploading did not take place). Once you made sure that you are logged in, you can click on saveone() or on saveall(), in which case the script will continue uploading the next 20 records.

Disadvantages

There is no feedback. The script does not know whether the form submission was successful or not. There is a simple delay between the submissions.

We need a user browser, and the script cannot be run offline from a server.

I believe that a developer with an experience with these kinds of things can solve these two problems. The first problem is critical. The way we must control the uploading is to query the database and retrieve the users which are not updated. After which we must rerun the script for those users.

Update

A bug is fixed. The previous version inactivated the updated accounts by causing an invalid expiry date. This version seems is functional.

The following files are provided.

5.txt

6.html

7.txt

8.zip

In this version the data is separated from the script. The script is in 6.html file. You do not need to modify the html file. You only need to change the 5.txt file to provide your data.

END

***

© 4z.com