USE asterisk_db;

SHOW DATABASES;

SHOW TABLES;


SELECT * FROM `ps_endpoints`;

DELETE FROM `ps_endpoints` WHERE `id` = '1004';

SELECT * FROM `extensions_table`;
DESCRIBE `extensions_table`;

ALTER TABLE `extensions_table`
ADD CONSTRAINT `extension_table_unique_val_two_check` UNIQUE (`exten`, `appdata`);


ALTER TABLE `extensions_table`
DROP INDEX `extension_table_unique_val`;


ALTER TABLE `extensions_table`
ADD CONSTRAINT `extension_table_unique_val` UNIQUE (`exten`, `appdata`, `priority`);

DELETE FROM `extensions_table` WHERE priority = 4 and exten = "1005" ;
DELETE FROM `extensions_table` WHERE exten = "1005" OR exten = "1004";

DELETE FROM `ps_endpoints` WHERE id = "1004" OR id = "1005";


SELECT * FROM `extensions_table` WHERE app = "Dial";

-- 
SELECT * FROM ps_auths;
SELECT * FROM ps_aors;
DESCRIBE `ps_auths`;
DESCRIBE `ps_aors`;

INSERT INTO `ps_aors`(`id`,`max_contacts`) VALUES ("1004", 1);
INSERT INTO `ps_auths`(`id`, `auth_type`, `username`, `password`, `md5_cred`, `realm`) VALUES("1004", "userpass", "1004", "12345", null, null);
