diff --git a/MySQL_conf_pbx/test1/conf/asterisk/func_odbc.conf b/MySQL_conf_pbx/test1/conf/asterisk/func_odbc.conf index fce8a92..3266b23 100755 --- a/MySQL_conf_pbx/test1/conf/asterisk/func_odbc.conf +++ b/MySQL_conf_pbx/test1/conf/asterisk/func_odbc.conf @@ -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() + + + + + + + diff --git a/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 b/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 index 964ee6f..22e2e95 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 and b/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/aria_log_control b/MySQL_conf_pbx/test1/mariadb_data/aria_log_control index 77cc87c..6821958 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/aria_log_control and b/MySQL_conf_pbx/test1/mariadb_data/aria_log_control differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.frm b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.frm index f1ab812..89cf7ec 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.frm and b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.frm differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.ibd b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.ibd index 1b4fcfc..015a7d7 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.ibd and b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.ibd differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/ddl_recovery-backup.log b/MySQL_conf_pbx/test1/mariadb_data/ddl_recovery-backup.log new file mode 100644 index 0000000..5e30b6d Binary files /dev/null and b/MySQL_conf_pbx/test1/mariadb_data/ddl_recovery-backup.log differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/ddl_recovery.log b/MySQL_conf_pbx/test1/mariadb_data/ddl_recovery.log index 5e30b6d..4646fb8 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/ddl_recovery.log and b/MySQL_conf_pbx/test1/mariadb_data/ddl_recovery.log differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 b/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 index cb014f0..3f5a9f9 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 and b/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/ibdata1 b/MySQL_conf_pbx/test1/mariadb_data/ibdata1 index 8e4c647..f199271 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/ibdata1 and b/MySQL_conf_pbx/test1/mariadb_data/ibdata1 differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_index_stats.ibd b/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_index_stats.ibd index 239f874..35e2004 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_index_stats.ibd and b/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_index_stats.ibd differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_table_stats.ibd b/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_table_stats.ibd index 6bb97d4..d13cb75 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_table_stats.ibd and b/MySQL_conf_pbx/test1/mariadb_data/mysql/innodb_table_stats.ibd differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/undo001 b/MySQL_conf_pbx/test1/mariadb_data/undo001 index f34eb86..52f2399 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/undo001 and b/MySQL_conf_pbx/test1/mariadb_data/undo001 differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/undo002 b/MySQL_conf_pbx/test1/mariadb_data/undo002 index c68b06c..dd5f5e9 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/undo002 and b/MySQL_conf_pbx/test1/mariadb_data/undo002 differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/undo003 b/MySQL_conf_pbx/test1/mariadb_data/undo003 index 1c72e7c..3b4e90f 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/undo003 and b/MySQL_conf_pbx/test1/mariadb_data/undo003 differ diff --git a/MySQL_conf_pbx/test1/recordings/1001-1743156639.12.wav b/MySQL_conf_pbx/test1/recordings/1001-1743156639.12.wav new file mode 100644 index 0000000..a192682 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1001-1743156639.12.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1001-1743156696.16.wav b/MySQL_conf_pbx/test1/recordings/1001-1743156696.16.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1001-1743156696.16.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1001-1743156742.25.wav b/MySQL_conf_pbx/test1/recordings/1001-1743156742.25.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1001-1743156742.25.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1002-1743156639.12.wav b/MySQL_conf_pbx/test1/recordings/1002-1743156639.12.wav new file mode 100644 index 0000000..a192682 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1002-1743156639.12.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1002-1743156696.16.wav b/MySQL_conf_pbx/test1/recordings/1002-1743156696.16.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1002-1743156696.16.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1002-1743156742.25.wav b/MySQL_conf_pbx/test1/recordings/1002-1743156742.25.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1002-1743156742.25.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1003-1743156619.10.wav b/MySQL_conf_pbx/test1/recordings/1003-1743156619.10.wav new file mode 100644 index 0000000..91e102b Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1003-1743156619.10.wav differ diff --git a/MySQL_conf_pbx/test1/three_users.sql b/MySQL_conf_pbx/test1/three_users.sql index eef6500..717e223 100644 --- a/MySQL_conf_pbx/test1/three_users.sql +++ b/MySQL_conf_pbx/test1/three_users.sql @@ -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;