Host network mods + mariaDB

This commit is contained in:
MathewFrancis 2025-03-19 17:57:27 +05:30
parent 5c637771e8
commit 840617da84
21 changed files with 198 additions and 39 deletions

View File

@ -8,15 +8,8 @@
; Defaults are rtpstart=5000 and rtpend=31000 ; Defaults are rtpstart=5000 and rtpend=31000
; ;
rtpstart=10000 rtpstart=10000
rtpend=10050 rtpend=20000
;strictrtp=no
;rtpstart=20000
;rtpend=21000
strictrtp=no
probation=8
;rtpend=20000
; ;
; Whether to enable or disable UDP checksums on RTP traffic ; Whether to enable or disable UDP checksums on RTP traffic
; ;
@ -136,7 +129,7 @@ probation=8
; by default. The minimum MTU is 256. ; by default. The minimum MTU is 256.
; dtls_mtu = 1200 ; dtls_mtu = 1200
; ;
[ice_host_candidates] ;[ice_host_candidates]
; ;
; When Asterisk is behind a static one-to-one NAT and ICE is in use, ICE will ; When Asterisk is behind a static one-to-one NAT and ICE is in use, ICE will
; expose the server's internal IP address as one of the host candidates. ; expose the server's internal IP address as one of the host candidates.

View File

@ -7,12 +7,13 @@
;Password = asterisk_pass ;Password = asterisk_pass
;Port = 3306 ;Port = 3306
;Option = 3 ;Option = 3
;${HOST_IP}
[asterisk] [asterisk]
Description = MariaDB connection to Asterisk Description = MariaDB connection to Asterisk
Driver = MariaDB Driver = MariaDB
Server = mat_mariadb ;Server = 172.20.100.122
Server = 127.0.0.1
Database = asterisk_db Database = asterisk_db
User = asterisk_user User = asterisk_user
Password = asterisk_pass Password = asterisk_pass

View File

@ -7,17 +7,11 @@ services:
tty: true tty: true
depends_on: depends_on:
- mariadb - mariadb
ports:
- "5060:5060/udp" # SIP signaling
# - "5060:5060/tcp" # SIP signaling (TCP fallback)
#- "20000-21000:20000-21000/udp" # RTP ports for audio
- "10000-10050:10000-10050/udp" # RTP ports
volumes: volumes:
- ./conf/odbc.ini:/etc/odbc.ini - ./conf/odbc.ini:/etc/odbc.ini
- ./conf/odbcinst.ini:/etc/odbcinst.ini - ./conf/odbcinst.ini:/etc/odbcinst.ini
- ./conf/asterisk/:/etc/asterisk/ - ./conf/asterisk/:/etc/asterisk/
networks: network_mode: "host"
- asterisk-net
mariadb: mariadb:
image: mariadb image: mariadb
@ -30,24 +24,6 @@ services:
MYSQL_PASSWORD: asterisk_pass MYSQL_PASSWORD: asterisk_pass
volumes: volumes:
- ./mariadb_data:/var/lib/mysql # Persistent data - ./mariadb_data:/var/lib/mysql # Persistent data
ports: network_mode: "host"
- "3307:3306"
networks:
- asterisk-net
# *** only needed if your not running docker as a sudo user necessary for mariadb container db access
# user: "999:999" # Ensures the container runs as the mysql user, matching volume ownership
# command: "--innodb-buffer-pool-size=256M"
# healthcheck: # Optional: Ensure MariaDB is healthy before Asterisk connects
# test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-prootpassword"]
# interval: 10s
# timeout: 5s
# retries: 5
# ***
networks:
asterisk-net:
driver: bridge
# #

Binary file not shown.

Binary file not shown.

9
MySQL_conf_pbx/test1/mariadb_data/ib_buffer_pool Executable file → Normal file
View File

@ -1,13 +1,20 @@
14,5
14,4
14,3
14,2
14,1
14,0
11,4 11,4
11,3 11,3
10,3 10,3
9,3 9,3
8,3
7,3 7,3
5,3 5,3
4,3 4,3
3,2 3,2
2,2
1,2 1,2
0,9
1,45 1,45
3,44 3,44
2,44 2,44

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,91 @@
USE asterisk_db;
CREATE TABLE ps_endpoints (
id VARCHAR(40) NOT NULL PRIMARY KEY,
transport VARCHAR(40) NULL,
aors VARCHAR(200) NULL,
auth VARCHAR(40) NULL,
context VARCHAR(40) NULL,
disallow VARCHAR(200) NULL,
allow VARCHAR(200) NULL,
direct_media VARCHAR(40) NULL,
connected_line_method VARCHAR(40) NULL,
callerid VARCHAR(40) NULL,
dtmf_mode VARCHAR(40) NULL
);
CREATE TABLE ps_auths (
id VARCHAR(40) NOT NULL PRIMARY KEY,
auth_type VARCHAR(40) NOT NULL,
username VARCHAR(40) NULL,
password VARCHAR(40) NULL,
md5_cred VARCHAR(40) NULL,
realm VARCHAR(40) NULL
);
CREATE TABLE ps_aors (
id VARCHAR(40) NOT NULL PRIMARY KEY,
max_contacts INTEGER NULL
);
CREATE TABLE extensions_table (
id INT AUTO_INCREMENT PRIMARY KEY,
context VARCHAR(50) NOT NULL,
exten VARCHAR(50) NOT NULL,
priority INT NOT NULL,
app VARCHAR(50) NOT NULL,
appdata VARCHAR(100)
);
INSERT INTO ps_endpoints (id, transport, aors, auth, context, disallow, allow)
VALUES ('1001', 'transport-udp', '1001', '1001', 'default', 'all', 'ulaw,alaw');
INSERT INTO ps_auths (id, auth_type, username, password)
VALUES ('1001', 'userpass', '1001', 'mypassword');
INSERT INTO ps_aors (id, max_contacts)
VALUES ('1001', 1);
-- Add Authentication for 1002
INSERT INTO ps_auths (id, auth_type, username, password)
VALUES ('1002', 'userpass', '1002', 'securepass');
-- Add Endpoint for 1002
INSERT INTO ps_endpoints (id, transport, aors, auth, context, disallow, allow, direct_media)
VALUES ('1002', 'transport-udp', '1002', '1002', 'default', 'all', 'ulaw,alaw', 'no');
-- Add AOR (Address of Record) for 1002
INSERT INTO ps_aors (id, max_contacts)
VALUES ('1002', 2);
INSERT INTO extensions_table (context, exten, priority, app, appdata)
VALUES
('default', '1001', 1, 'Dial', 'PJSIP/1001,20'),
('default', '1002', 1, 'Dial', 'PJSIP/1002,20');
SELECT * FROM extensions_table;
ALTER TABLE ps_endpoints
ADD COLUMN rtp_symmetric VARCHAR(5) DEFAULT 'yes',
ADD COLUMN force_rport VARCHAR(5) DEFAULT 'yes',
ADD COLUMN rewrite_contact VARCHAR(5) DEFAULT 'yes';
UPDATE ps_endpoints
SET rtp_symmetric='yes', force_rport='yes', rewrite_contact='yes'
WHERE id IN ('1001', '1002');
SELECT * FROM ps_endpoints;
DROP TABLE `ps_endpoints`;
SHOW TABLES;

View File

@ -0,0 +1,91 @@
USE asterisk_db;
CREATE TABLE ps_endpoints (
id VARCHAR(40) NOT NULL PRIMARY KEY,
transport VARCHAR(40) NULL,
aors VARCHAR(200) NULL UNIQUE,
auth VARCHAR(40) NULL UNIQUE,
context VARCHAR(40) NULL,
disallow VARCHAR(200) NULL,
allow VARCHAR(200) NULL,
direct_media VARCHAR(40) NULL,
connected_line_method VARCHAR(40) NULL,
callerid VARCHAR(40) NULL,
dtmf_mode VARCHAR(40) NULL
);
CREATE TABLE ps_auths (
id VARCHAR(40) NOT NULL PRIMARY KEY,
auth_type VARCHAR(40) NOT NULL,
username VARCHAR(40) NULL UNIQUE,
password VARCHAR(40) NULL,
md5_cred VARCHAR(40) NULL,
realm VARCHAR(40) NULL
);
CREATE TABLE ps_aors (
id VARCHAR(40) NOT NULL PRIMARY KEY,
max_contacts INTEGER NULL
);
CREATE TABLE extensions_table (
id INT AUTO_INCREMENT PRIMARY KEY,
context VARCHAR(50) NOT NULL,
exten VARCHAR(50) NOT NULL UNIQUE,
priority INT NOT NULL,
app VARCHAR(50) NOT NULL,
appdata VARCHAR(100)
);
INSERT INTO ps_endpoints (id, transport, aors, auth, context, disallow, allow)
VALUES ('1001', 'transport-udp', '1001', '1001', 'default', 'all', 'ulaw,alaw');
INSERT INTO ps_auths (id, auth_type, username, password)
VALUES ('1001', 'userpass', '1001', '12345');
INSERT INTO ps_aors (id, max_contacts)
VALUES ('1001', 1);
-- Add Endpoint for 1002
INSERT INTO ps_endpoints (id, transport, aors, auth, context, disallow, allow, direct_media)
VALUES ('1002', 'transport-udp', '1002', '1002', 'default', 'all', 'ulaw,alaw', 'no');
-- Add Authentication for 1002
INSERT INTO ps_auths (id, auth_type, username, password)
VALUES ('1002', 'userpass', '1002', '12345');
-- Add AOR (Address of Record) for 1002
INSERT INTO ps_aors (id, max_contacts)
VALUES ('1002', 2);
INSERT INTO ps_endpoints (id, transport, aors, auth, context, disallow, allow, direct_media)
VALUES ('1003', 'transport-udp', '1003', '1003', 'default', 'all', 'ulaw,alaw', 'no');
-- Add Authentication for 1002
INSERT INTO ps_auths (id, auth_type, username, password)
VALUES ('1003', 'userpass', '1003', '12345');
-- Add AOR (Address of Record) for 1002
INSERT INTO ps_aors (id, max_contacts)
VALUES ('1003', 2);
INSERT INTO extensions_table (context, exten, priority, app, appdata)
VALUES
('default', '1001', 1, 'Dial', 'PJSIP/1001,20'),
('default', '1002', 1, 'Dial', 'PJSIP/1002,20'),
('default', '1003', 1, 'Dial', 'PJSIP/1003,20');
SELECT * FROM extensions_table;
-- DROP TABLE `extensions_table`;
SELECT * FROM extensions_table WHERE context='default';
SHOW TABLES;