DND try 1

This commit is contained in:
MathewFrancis 2025-03-27 12:52:35 +05:30
parent 065474018d
commit 4962e0a63c
31 changed files with 89 additions and 0 deletions

View File

@ -125,3 +125,35 @@ 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
;[GET_STATUS]
;dsn=asterisk
;readsql=SELECT status FROM user_status WHERE extension='${ARG1}'
;[UPDATE_STATUS]
;dsn=asterisk
;writesql=INSERT INTO user_status (extension, status, updated_at)
;VALUES ('${ARG1}', '${ARG2}', NOW())
;ON DUPLICATE KEY UPDATE status='${ARG2}', updated_at=NOW()
;[UPDATE_STATUS]
;dsn=asterisk
;write=UPDATE agents SET status = ${ARG2} WHERE extension = ${ARG1}
;writesql=INSERT INTO user_status (extension, status) VALUES ('${ARG1}', '${ARG2}') ON DUPLICATE KEY UPDATE status='${ARG2}', updated_at=NOW()
[UPDATE_DND_STATUS]
dsn=asterisk
writesql=INSERT INTO dnd_status (extension, status) VALUES ('${ARG1}', '${ARG2}') ON DUPLICATE KEY UPDATE status='${ARG2}', updated_at=NOW()
[GET_DND_STATUS]
dsn=asterisk
readsql=SELECT status FROM dnd_status WHERE extension='${ARG1}'

View File

@ -1,3 +1,8 @@
13,4
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.

View File

@ -144,6 +144,58 @@ WHERE app = 'Dial';
-- music on hold end
-- DND/profiling
USE asterisk_db;
CREATE TABLE user_status (
id INT AUTO_INCREMENT PRIMARY KEY,
extension VARCHAR(10) NOT NULL UNIQUE,
status ENUM('Available', 'Away', 'Busy', 'DND') NOT NULL DEFAULT 'Available',
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
-- Set Status
-- INSERT INTO extensions_table (context, exten, priority, app, appdata) VALUES
-- ('default', '*21', 1, 'Read', 'USER_STATUS,,4'),
-- ('default', '*21', 2, 'Set', 'ODBC_UPDATE_STATUS=${ODBC_UPDATE_STATUS(${CALLERID(num)},${USER_STATUS})}'),
-- ('default', '*21', 3, 'Playback', 'status-updated'),
-- ('default', '*21', 4, 'Hangup', NULL);
INSERT INTO extensions_table (context, exten, priority, app, appdata)
VALUES
('default', '*21', 1, 'Read', 'USER_STATUS,,4'),
('default', '*21', 2, 'ExecIf', '$[${LEN(${USER_STATUS})}>0]?Set(ODBC_UPDATE_STATUS()=${CALLERID(num)},${USER_STATUS})'),
('default', '*21', 3, 'Hangup', '');
-- Get Status
INSERT INTO extensions_table (context, exten, priority, app, appdata) VALUES
('default', '*22', 1, 'Set', 'USER_STATUS=${ODBC_GET_STATUS(${CALLERID(num)})}'),
('default', '*22', 2, 'Playback', '${USER_STATUS}'),
('default', '*22', 3, 'Hangup', NULL);
SELECT * FROM user_status;
INSERT INTO user_status (extension, status, updated_at)
VALUES ('1001', '2', NOW())
ON DUPLICATE KEY UPDATE status = '3', updated_at = NOW();
DESC user_status;
SELECT * FROM `extensions_table`;
SELECT * FROM user_status WHERE extension = '1001';
DELETE FROM `extensions_table` WHERE exten = '*22' OR exten = '*21';
-- DND/profiling END
-- update the dial plan
UPDATE extensions_table