Compare commits

...

5 Commits

Author SHA1 Message Date
dc761a2618 profile END 2025-04-01 16:58:52 +05:30
7744206b90 DND done without tone 2025-03-28 15:52:36 +05:30
c8b7c8603b Start fresh 2025-03-28 13:56:28 +05:30
764ac6b04b ReFormat 2025-03-28 13:50:38 +05:30
008efed094 Try DND 1 2025-03-28 11:22:34 +05:30
61 changed files with 56 additions and 14 deletions

View File

@ -125,3 +125,21 @@ synopsis=Check if a specified callerid is contained in the known solicitors data
writehandle=mysql1
readsql=SELECT location FROM presence WHERE id='${SQL_ESC(${ARG1})}'
writesql=UPDATE presence SET location='${SQL_ESC(${VAL1})}' WHERE id='${SQL_ESC(${ARG1})}'
;mat conf
[GET_DND_STATUS]
dsn=asterisk
readsql=SELECT status FROM dnd_status WHERE extension='${ARG1}'
[SET_DND_STATUS]
dsn=asterisk
writesql=INSERT INTO dnd_status (extension, status) VALUES ('${ARG1}', '${ARG2}')
ON DUPLICATE KEY UPDATE status='${ARG2}', updated_at=NOW()

View File

@ -1,3 +1,7 @@
13,3
13,2
13,1
13,0
11,3
11,2
11,1

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.

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

@ -38,6 +38,7 @@ CREATE TABLE extensions_table (
appdata VARCHAR(100)
);
ALTER TABLE extensions_table MODIFY appdata VARCHAR(200);
INSERT INTO ps_endpoints (id, transport, aors, auth, context, disallow, allow)
@ -144,28 +145,47 @@ WHERE app = 'Dial';
-- music on hold end
-- DND
-- update the dial plan
UPDATE extensions_table
SET appdata = 'PJSIP/1001,20,g'
WHERE exten = '1001' AND app = 'Dial';
CREATE TABLE IF NOT EXISTS dnd_status (
extension VARCHAR(10) PRIMARY KEY,
status ENUM('ON', 'OFF') NOT NULL,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
-- g here ensures it captures the DIALSTATUS even after the call ends
-- Enable DND (*78)
INSERT INTO extensions_table (context, exten, priority, app, appdata)
VALUES
('default', '*78', 1, 'Set', 'RESULT=${ODBC_SQL(${CALLERID(num)}, ON)}'),
-- ('default', '*78', 2, 'Playback', 'dnd-activated'),
('default', '*78', 3, 'Hangup', '');
ALTER TABLE `ps_endpoints` ADD mohsuggest VARCHAR(40);
ALTER TABLE `ps_endpoints` ADD mailboxes VARCHAR(255);
-- Disable DND (*79)
INSERT INTO extensions_table (context, exten, priority, app, appdata)
VALUES
('default', '*79', 1, 'Set', 'RESULT=${ODBC_SQL(${CALLERID(num)}, OFF)}'),
-- ('default', '*79', 2, 'Playback', 'dnd-deactivated'),
('default', '*79', 3, 'Hangup', '');
UPDATE ps_endpoints SET mohsuggest = 'default';
UPDATE ps_endpoints SET direct_media = 'no';
SELECT * FROM `ps_endpoints`;
-- Enable DND (*78)
INSERT INTO extensions_table (context, exten, priority, app, appdata)
VALUES ('default', '*78', 1, 'System', 'mysql -uasterisk_user -p12345 -h127.0.0.1 -P3308 -e "INSERT INTO asterisk_db.dnd_status (extension, status) VALUES (\'${CALLERID(num)}\', \'ON\') ON DUPLICATE KEY UPDATE status=\'ON\', updated_at=NOW();"'),
('default', '*78', 2, 'Playback', 'dnd-activated'),
('default', '*78', 3, 'Hangup', NULL);
-- Disable DND (*79)
INSERT INTO extensions_table (context, exten, priority, app, appdata)
VALUES ('default', '*79', 1, 'System', 'mysql -uasterisk_user -p12345 -h127.0.0.1 -P3308 -e "INSERT INTO asterisk_db.dnd_status (extension, status) VALUES (\'${CALLERID(num)}\', \'OFF\') ON DUPLICATE KEY UPDATE status=\'OFF\', updated_at=NOW();"'),
('default', '*79', 2, 'Playback', 'dnd-deactivated'),
('default', '*79', 3, 'Hangup', NULL);
SELECT * FROM extensions_table;
SELECT * FROM `extensions_table`;
-- DROP TABLE `extensions_table`;
DELETE FROM `extensions_table` WHERE exten = '*78' OR exten = '*79';
-- end of DND
SELECT * FROM extensions_table WHERE context='default';
SHOW TABLES;