Mysql database usage by ASTPP
By Ignat Kononov on 2021-05-27
Contents
In this document, we look at how astpp uses mysql tables and what columns are used for local calls.
CentOs 7 server with ASTPP.
In order to install ASTPP, this document must be followed from the beginning till the end: https://docs.switzernet.com/3/public/210311-astpp-instalation/
To enter the mysql interface by the mysql root user, use the following commands:
sudo su
mysql -u root -p
And enter mysql root user password.
Now let's check the existing databases:
Show databases;
Now check tables from the astpp database:
Full tables list: 2.txt
Now check columns in table accounts:
use astpp;
DESCRIBE accounts;
Full accounts columns list: 3.txt
Now check columns id and first_name in the table accounts:
SELECT id, first_name FROM accounts;
Now let's check what data in the tables ASTPP uses in local calls.
Let's look at the fs_cli logs of the local call: 4.txt
From 58 to 88 strings, we see such queries to the database ASTPP:
SELECT name,value FROM `system` WHERE group_title IN ('global','opensips','callingcard','calls','InternationalPrefixes')
SELECT package_name FROM addons
SELECT access_number FROM accessnumber WHERE access_number = '' AND status=0 limit 1
SELECT A.id as id,A.number as did_number,B.id as accountid,B.number as account_code,A.number as did_number,A.connectcost,A.includedseconds,A.cost,A.inc,A.extensions,A.maxchannels,A.call_type,A.city,A.province,A.init_inc,A.leg_timeout,A.status,A.country_id,A.call_type_vm_flag FROM dids AS A,accounts AS B WHERE B.status=0 AND B.deleted=0 AND B.id=A.accountid AND A.number ="7843973936" LIMIT 1
SELECT sip_devices.username as username,accounts.number as accountcode,sip_devices.accountid as accountid,accounts.did_cid_translation as did_cid_translation FROM sip_devices as sip_devices,accounts as accounts WHERE accounts.status=0 AND accounts.deleted=0 AND accounts.id=sip_devices.accountid AND sip_devices.username="" limit 1
SELECT * FROM accounts WHERE number = "8620826254" AND deleted = 0 limit 1
SELECT A.number FROM speed_dial as A,accounts as B WHERE B.status=0 AND B.deleted=0 AND B.id=A.accountid AND A.speed_num ="" AND A.accountid = '14' limit 1
SELECT A.id as id,A.number as did_number,B.id as accountid,B.number as account_code,A.number as did_number,A.connectcost,A.includedseconds,A.cost,A.inc,A.extensions,A.maxchannels,A.call_type,A.city,A.province,A.init_inc,A.leg_timeout,A.status,A.country_id,A.call_type_vm_flag FROM dids AS A,accounts AS B WHERE B.status=0 AND B.deleted=0 AND B.id=A.accountid AND A.number ="" LIMIT 1
SELECT sip_devices.username as username,accounts.number as accountcode,sip_devices.accountid as accountid,accounts.did_cid_translation as did_cid_translation FROM sip_devices as sip_devices,accounts as accounts WHERE accounts.status=0 AND accounts.deleted=0 AND accounts.id=sip_devices.accountid AND sip_devices.username="" limit 1
Query :SELECT * FROM dids WHERE number ="" AND (accountid = 0 OR status = 1) LIMIT 1
SELECT *,P.id as package_id,P.product_id as product_id FROM packages_view as P inner join package_patterns as PKGPTR on P.product_id = PKGPTR.product_id WHERE (patterns = '^.*' OR patterns = '^.*' OR patterns = '^.*' OR patterns = '^7843973.*' OR patterns = '^.*' OR patterns = '^.*' OR patterns = '^.*' OR patterns = '^.*' OR patterns = '^78.*' OR patterns = '^7.*' OR patterns ='--') AND accountid = 14 ORDER BY LENGTH(PKGPTR.patterns) DESC
SELECT sip_devices.username as username,accounts.number as accountcode,sip_devices.accountid as accountid,accounts.did_cid_translation as did_cid_translation FROM sip_devices as sip_devices,accounts as accounts WHERE accounts.status=0 AND accounts.deleted=0 AND accounts.id=sip_devices.accountid AND sip_devices.username="7843973936" limit 1
***
© 4z.com