Extension is not unique !!!
The value can be none on multiple extensions
show create table missedcall \G;
*************************** 1. row ***************************
Table: missedcall
Create Table: CREATE TABLE `missedcall` (
`userid` int(11) NOT NULL,
`notification` smallint(6) DEFAULT '0',
`extension` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` smallint(6) DEFAULT NULL,
`ringgroup` smallint(6) DEFAULT NULL,
`internal` smallint(6) DEFAULT NULL,
`external` smallint(6) DEFAULT NULL,
PRIMARY KEY (`userid`),
UNIQUE KEY `extension` (`extension`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
This breaks user management fixing this
use asterisk
alter table missedcall drop index extension
;
MariaDB [asterisk]> select * from missedcall;
+--------+--------------+-----------+-------+-----------+----------+----------+
| userid | notification | extension | queue | ringgroup | internal | external |
+--------+--------------+-----------+-------+-----------+----------+----------+
| 1 | 1 | none | 0 | 0 | 0 | 0 |
| 3 | 0 | 5001 | 0 | 0 | 0 | 0 |
| 4 | 0 | none | 0 | 0 | 0 | 0 |
| 5 | 0 | 6001 | NULL | NULL | NULL | NULL |
| 6 | 0 | 5701 | NULL | NULL | NULL | NULL |
| 7 | 0 | 5002 | 0 | 0 | 0 | 0 |
| 8 | 0 | 9919988 | NULL | NULL | NULL | NULL |
| 9 | 0 | 5711 | 0 | 0 | 0 | 0 |
+--------+--------------+-----------+-------+-----------+----------+----------+