Music on hold

This commit is contained in:
MathewFrancis 2025-03-25 15:23:54 +05:30
parent af9ea1682b
commit 065474018d
48 changed files with 62 additions and 7 deletions

View File

@ -8,12 +8,12 @@ RUN apk update && \
apk add unixodbc && \ apk add unixodbc && \
apk add unixodbc-dev && \ apk add unixodbc-dev && \
apk add mariadb-connector-odbc && \ apk add mariadb-connector-odbc && \
apk add --no-cache ffmpeg && \ mkdir -p /etc/asterisk/moh
apk add --no-cache lame && \
apk add --no-cache asterisk-mp3
# apk add --no-cache unixodbc unixodbc-dev mariadb-connector-odbc # apk add --no-cache unixodbc unixodbc-dev mariadb-connector-odbc
# Copy custom Asterisk config files # Copy custom Asterisk config files
#COPY asterisk_config/ /etc/asterisk/ #COPY asterisk_config/ /etc/asterisk/

View File

@ -132,6 +132,9 @@ ps_endpoints => odbc,asterisk,ps_endpoints
ps_auths => odbc,asterisk,ps_auths ps_auths => odbc,asterisk,ps_auths
ps_aors => odbc,asterisk,ps_aors ps_aors => odbc,asterisk,ps_aors
extensions => odbc,asterisk,extensions_table extensions => odbc,asterisk,extensions_table
;moh for music on hold
;moh => odbc,asterisk,moh_classes

Binary file not shown.

View File

@ -1,7 +1,7 @@
; ;
; Music on Hold -- Sample Configuration ; Music on Hold -- Sample Configuration
; ;
[general] ;[general]
;cachertclasses=yes ; use 1 instance of moh class for all users who are using it, ;cachertclasses=yes ; use 1 instance of moh class for all users who are using it,
; decrease consumable cpu cycles and memory ; decrease consumable cpu cycles and memory
; disabled by default ; disabled by default
@ -62,9 +62,18 @@
; configuration. The 'sort' option is not used for this mode. ; configuration. The 'sort' option is not used for this mode.
; ;
;[default]
;mode=files
;directory=moh
[default] [default]
mode=files mode=files
directory=moh directory=/etc/asterisk/moh
;sort=random
random=yes
; ;
;[native-random] ;[native-random]
;mode=files ;mode=files

View File

@ -1,7 +1,7 @@
version: "3.8" version: "3.8"
services: services:
asterisk: asterisk:
image: mathewfrancisv/odbc_mariadb:v2.0.0 image: mathewfrancisv/odbc_mariadb:v2.0.1
container_name: mat_asterisk container_name: mat_asterisk
restart: always restart: always
tty: true tty: true

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -107,8 +107,44 @@ VALUES
INSERT INTO extensions_table (context, exten, priority, app, appdata) INSERT INTO extensions_table (context, exten, priority, app, appdata)
VALUES VALUES
('default', '1001', 5, 'GotoIf', '${DIALSTATUS}=NOANSWER?default,1002,1'); ('default', '1001', 5, 'GotoIf', '${DIALSTATUS}=NOANSWER?default,1002,1');
-- --
-- music on hold
USE asterisk_db;
-- CREATE TABLE moh_classes (
-- name VARCHAR(40) PRIMARY KEY,
-- mode VARCHAR(20) NOT NULL,
-- directory VARCHAR(255),
-- application VARCHAR(255),
-- digit INTEGER DEFAULT NULL,
-- sort VARCHAR(10) DEFAULT 'random'
-- );
--
-- INSERT INTO moh_classes (name, mode, directory, sort)
-- VALUES
-- ('default', 'files', '/etc/asterisk/moh', 'random');
--
-- SELECT * FROM moh_classes;
--
-- DROP TABLE `moh_classes`;
INSERT INTO extensions_table (context, exten, priority, app, appdata)
VALUES
('default', '1001', 20, 'MusicOnHold', 'default'),
('default', '1002', 20, 'MusicOnHold', 'default'),
('default', '1003', 20, 'MusicOnHold', 'default');
UPDATE extensions_table
SET appdata = CONCAT(appdata, ',m(default)')
WHERE app = 'Dial';
-- music on hold end
-- update the dial plan -- update the dial plan
UPDATE extensions_table UPDATE extensions_table
SET appdata = 'PJSIP/1001,20,g' SET appdata = 'PJSIP/1001,20,g'
@ -116,6 +152,13 @@ WHERE exten = '1001' AND app = 'Dial';
-- g here ensures it captures the DIALSTATUS even after the call ends -- g here ensures it captures the DIALSTATUS even after the call ends
ALTER TABLE `ps_endpoints` ADD mohsuggest VARCHAR(40);
ALTER TABLE `ps_endpoints` ADD mailboxes VARCHAR(255);
UPDATE ps_endpoints SET mohsuggest = 'default';
UPDATE ps_endpoints SET direct_media = 'no';
SELECT * FROM `ps_endpoints`;
SELECT * FROM extensions_table; SELECT * FROM extensions_table;