diff --git a/MySQL_conf_pbx/test1/conf/asterisk/func_odbc.conf b/MySQL_conf_pbx/test1/conf/asterisk/func_odbc.conf index fce8a92..0987af9 100755 --- a/MySQL_conf_pbx/test1/conf/asterisk/func_odbc.conf +++ b/MySQL_conf_pbx/test1/conf/asterisk/func_odbc.conf @@ -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}' + + + + + + diff --git a/MySQL_conf_pbx/test1/Script-1.sql b/MySQL_conf_pbx/test1/dockerfilez/4/Script-1.sql similarity index 100% rename from MySQL_conf_pbx/test1/Script-1.sql rename to MySQL_conf_pbx/test1/dockerfilez/4/Script-1.sql diff --git a/MySQL_conf_pbx/test1/dial_plan_and_Ext.sql b/MySQL_conf_pbx/test1/dockerfilez/4/dial_plan_and_Ext.sql similarity index 100% rename from MySQL_conf_pbx/test1/dial_plan_and_Ext.sql rename to MySQL_conf_pbx/test1/dockerfilez/4/dial_plan_and_Ext.sql diff --git a/MySQL_conf_pbx/test1/theAlter.sql b/MySQL_conf_pbx/test1/dockerfilez/4/theAlter.sql similarity index 100% rename from MySQL_conf_pbx/test1/theAlter.sql rename to MySQL_conf_pbx/test1/dockerfilez/4/theAlter.sql diff --git a/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 b/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 index 964ee6f..5b8e258 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..1284777 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.ibd b/MySQL_conf_pbx/test1/mariadb_data/asterisk_db/extensions_table.ibd index 1b4fcfc..46e038d 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.log b/MySQL_conf_pbx/test1/mariadb_data/ddl_recovery.log index 5e30b6d..547a73d 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_buffer_pool b/MySQL_conf_pbx/test1/mariadb_data/ib_buffer_pool index 76d7bfb..5213424 100644 --- a/MySQL_conf_pbx/test1/mariadb_data/ib_buffer_pool +++ b/MySQL_conf_pbx/test1/mariadb_data/ib_buffer_pool @@ -1,3 +1,8 @@ +13,4 +13,3 +13,2 +13,1 +13,0 11,3 11,2 11,1 diff --git a/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 b/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 index cb014f0..afb7945 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..02c75cd 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..61839d9 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..a83ca7c 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..9ad23e6 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..7bc240f 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..21d47b6 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-1742903383.6.wav b/MySQL_conf_pbx/test1/recordings/1001-1742903383.6.wav new file mode 100644 index 0000000..0334324 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1001-1742903383.6.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1001-1742903402.8.wav b/MySQL_conf_pbx/test1/recordings/1001-1742903402.8.wav new file mode 100644 index 0000000..b1bfd2e Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1001-1742903402.8.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1001-1742969286.15.wav b/MySQL_conf_pbx/test1/recordings/1001-1742969286.15.wav new file mode 100644 index 0000000..01750c4 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1001-1742969286.15.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1001-1742970143.27.wav b/MySQL_conf_pbx/test1/recordings/1001-1742970143.27.wav new file mode 100644 index 0000000..aa755d0 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1001-1742970143.27.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1001-1742973303.52.wav b/MySQL_conf_pbx/test1/recordings/1001-1742973303.52.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1001-1742973303.52.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1001-1742973334.57.wav b/MySQL_conf_pbx/test1/recordings/1001-1742973334.57.wav new file mode 100644 index 0000000..ff6e5e5 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1001-1742973334.57.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1001-1742974144.64.wav b/MySQL_conf_pbx/test1/recordings/1001-1742974144.64.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1001-1742974144.64.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1002-1742969200.10.wav b/MySQL_conf_pbx/test1/recordings/1002-1742969200.10.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1002-1742969200.10.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1002-1742973303.52.wav b/MySQL_conf_pbx/test1/recordings/1002-1742973303.52.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1002-1742973303.52.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1002-1742973334.57.wav b/MySQL_conf_pbx/test1/recordings/1002-1742973334.57.wav new file mode 100644 index 0000000..ba75835 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1002-1742973334.57.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1002-1742974144.64.wav b/MySQL_conf_pbx/test1/recordings/1002-1742974144.64.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1002-1742974144.64.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1003-1742969110.4.wav b/MySQL_conf_pbx/test1/recordings/1003-1742969110.4.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1003-1742969110.4.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1003-1742969146.7.wav b/MySQL_conf_pbx/test1/recordings/1003-1742969146.7.wav new file mode 100644 index 0000000..64ec696 Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1003-1742969146.7.wav differ diff --git a/MySQL_conf_pbx/test1/recordings/1003-1742969319.18.wav b/MySQL_conf_pbx/test1/recordings/1003-1742969319.18.wav new file mode 100644 index 0000000..65bc0ed Binary files /dev/null and b/MySQL_conf_pbx/test1/recordings/1003-1742969319.18.wav differ diff --git a/MySQL_conf_pbx/test1/three_users.sql b/MySQL_conf_pbx/test1/three_users.sql index eef6500..ab11972 100644 --- a/MySQL_conf_pbx/test1/three_users.sql +++ b/MySQL_conf_pbx/test1/three_users.sql @@ -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