Internal Asterisk Database corrupted entries

Has anyone seen this? I don’t think that it is affecting performance… but I can’t imagine that it is good. Do any of you know how to clean up invalid entries in the internal Asterisk database?

All of the entries that do not start with ‘/DEVICE/’ don’t belong. I have a nightly script that logs the agents out of the queues and the users out of the devices. I think all of these entries came about during the testing phase of that script, but I’m not sure.

Asterisk 1.4.22-4 RPM


[pbx ~]# asterisk -rx "database show DEVICE"
/DEVICE/100/default_user                          : 100                      
/DEVICE/100/dial                                  : SIP/100                  
/DEVICE/100/type                                  : adhoc                    
/DEVICE/100/user                                  : none                     
/DEVICE/1000
1001
1013/user                       : none                     
/DEVICE/1000
1003
1008
1200/user                  : none                     
/DEVICE/1000
1003
1009
1013/user                  : none                     
/DEVICE/1000
1003
1013/user                       : none                     
/DEVICE/1000
1004
1014/user                       : none                     
/DEVICE/1000
1004
204/user                        : none                     
/DEVICE/1000
1004/user                            : none                     
/DEVICE/1000
1005
1007
1013/user                  : none                     
/DEVICE/1000
1005/user                            : none                     
/DEVICE/1000
1008
1009
1200/user                  : none                     
/DEVICE/1000
1008
1016
1100/user                  : none                     
/DEVICE/1000
1008
1016/user                       : none                     
/DEVICE/1000
1008/user                            : none                     
/DEVICE/1000
1009/user                            : none                     
/DEVICE/1000
1011/user                            : none                     
/DEVICE/1000
1012/user                            : none                     
/DEVICE/1000
1013/user                            : none                     
/DEVICE/1000
1014/user                            : none                     
/DEVICE/1000
1015/user                            : none                     
/DEVICE/1000
1016/user                            : none                     
/DEVICE/1000
1200
204/user                        : none                     
/DEVICE/1000
1200/user                            : none                     
/DEVICE/1000
204/user                             : none                     
/DEVICE/1000/default_user                         : 1000                     
/DEVICE/1000/dial                                 : SIP/1000                 
/DEVICE/1000/type                                 : adhoc                    
/DEVICE/1000/user                                 : 1000                     
/DEVICE/1001
204/user                             : none                     
/DEVICE/1001/default_user                         : none                     
/DEVICE/1001/dial                                 : SIP/1001                 
/DEVICE/1001/type                                 : adhoc                    
/DEVICE/1001/user                                 : none                     
/DEVICE/1002/default_user                         : none                     
/DEVICE/1002/dial                                 : SIP/1002                 
/DEVICE/1002/type                                 : adhoc                    
/DEVICE/1002/user                                 : 22                       
/DEVICE/1003
1200
204/user                        : none                     
/DEVICE/1003
1200/user                            : none                     
/DEVICE/1003
204/user                             : none                     
/DEVICE/1003/default_user                         : none                     
/DEVICE/1003/dial                                 : SIP/1003                 
/DEVICE/1003/type                                 : adhoc                    
/DEVICE/1003/user                                 : none                     
/DEVICE/1004
1014/user                            : none                     
/DEVICE/1004
1024
1025/user                       : none                     
/DEVICE/1004
1025/user                            : none                     
/DEVICE/1004
204/user                             : none                     
/DEVICE/1004/default_user                         : none                     
/DEVICE/1004/dial                                 : SIP/1004                 
/DEVICE/1004/type                                 : adhoc                    
/DEVICE/1004/user                                 : 09                       
/DEVICE/1005
1007/user                            : none                     
/DEVICE/1005
1024/user                            : none                     
/DEVICE/1005/default_user                         : none                     
/DEVICE/1005/dial                                 : SIP/1005                 
/DEVICE/1005/type                                 : adhoc                    
/DEVICE/1005/user                                 : 37                       
/DEVICE/1006/default_user                         : none                     
/DEVICE/1006/dial                                 : SIP/1006                 
/DEVICE/1006/type                                 : adhoc                    
/DEVICE/1006/user                                 : none                     
/DEVICE/1007/default_user                         : none                     
/DEVICE/1007/dial                                 : SIP/1007                 
/DEVICE/1007/type                                 : adhoc                    
/DEVICE/1007/user                                 : none                     
/DEVICE/1008
1200/user                            : none                     
/DEVICE/1008/default_user                         : none                     
/DEVICE/1008/dial                                 : SIP/1008                 
/DEVICE/1008/type                                 : adhoc                    
/DEVICE/1008/user                                 : none                     
/DEVICE/1009
1010/user                            : none                     
/DEVICE/1009
1024
1025/user                       : none                     
/DEVICE/1009
1024/user                            : none                     
/DEVICE/1009
1025/user                            : none                     
/DEVICE/1009
1200/user                            : none                     
/DEVICE/1009/default_user                         : none                     
/DEVICE/1009/dial                                 : SIP/1009                 
/DEVICE/1009/type                                 : adhoc                    
/DEVICE/1009/user                                 : none                     
/DEVICE/1010/default_user                         : none                     
/DEVICE/1010/dial                                 : SIP/1010                 
/DEVICE/1010/type                                 : adhoc                    
/DEVICE/1010/user                                 : 29                       
/DEVICE/1011
1024/user                            : none                     
/DEVICE/1011/default_user                         : none                     
/DEVICE/1011/dial                                 : SIP/1011                 
/DEVICE/1011/type                                 : adhoc                    
/DEVICE/1011/user                                 : 49                       
/DEVICE/1012
1100/user                            : none                     
/DEVICE/1012/default_user                         : none                     
/DEVICE/1012/dial                                 : SIP/1012                 
/DEVICE/1012/type                                 : adhoc                    
/DEVICE/1012/user                                 : none                     
/DEVICE/1013
1014/user                            : none                     
/DEVICE/1013/default_user                         : none                     
/DEVICE/1013/dial                                 : SIP/1013                 
/DEVICE/1013/type                                 : adhoc                    
/DEVICE/1013/user                                 : 40                       
/DEVICE/1014/default_user                         : none                     
/DEVICE/1014/dial                                 : SIP/1014                 
/DEVICE/1014/type                                 : adhoc                    
/DEVICE/1014/user                                 : 23                       
/DEVICE/1015
1024/user                            : none                     
/DEVICE/1015/default_user                         : none                     
/DEVICE/1015/dial                                 : SIP/1015                 
/DEVICE/1015/type                                 : adhoc                    
/DEVICE/1015/user                                 : none                     
/DEVICE/1016
204/user                             : none                     
/DEVICE/1016/default_user                         : none                     
/DEVICE/1016/dial                                 : SIP/1016                 
/DEVICE/1016/type                                 : adhoc                    
/DEVICE/1016/user                                 : none                     
/DEVICE/1017/default_user                         : none                     
/DEVICE/1017/dial                                 : SIP/1017                 
/DEVICE/1017/type                                 : adhoc                    
/DEVICE/1017/user                                 : none                     
/DEVICE/1018/default_user                         : 1018                     
/DEVICE/1018/dial                                 : SIP/1018                 
/DEVICE/1018/type                                 : adhoc                    
/DEVICE/1018/user                                 : 1018                     
/DEVICE/1019/default_user                         : 1019                     
/DEVICE/1019/dial                                 : SIP/1019                 
/DEVICE/1019/type                                 : adhoc                    
/DEVICE/1019/user                                 : 1019                     
/DEVICE/1020/default_user                         : 1020                     
/DEVICE/1020/dial                                 : SIP/1020                 
/DEVICE/1020/type                                 : adhoc                    
/DEVICE/1020/user                                 : 1020                     
/DEVICE/1021/default_user                         : 1021                     
/DEVICE/1021/dial                                 : SIP/1021                 
/DEVICE/1021/type                                 : adhoc                    
/DEVICE/1021/user                                 : 1021                     
/DEVICE/1022/default_user                         : 1022                     
/DEVICE/1022/dial                                 : SIP/1022                 
/DEVICE/1022/type                                 : adhoc                    
/DEVICE/1022/user                                 : 1022                     
/DEVICE/1023/default_user                         : 1023                     
/DEVICE/1023/dial                                 : SIP/1023                 
/DEVICE/1023/type                                 : adhoc                    
/DEVICE/1023/user                                 : 1023                     
/DEVICE/1024/default_user                         : none                     
/DEVICE/1024/dial                                 : SIP/1024                 
/DEVICE/1024/type                                 : adhoc                    
/DEVICE/1024/user                                 : none                     
/DEVICE/1025/default_user                         : none                     
/DEVICE/1025/dial                                 : SIP/1025                 
/DEVICE/1025/type                                 : adhoc                    
/DEVICE/1025/user                                 : none                     
/DEVICE/1100
204/user                             : none                     
/DEVICE/1100/default_user                         : none                     
/DEVICE/1100/dial                                 : SIP/1100                 
/DEVICE/1100/type                                 : adhoc                    
/DEVICE/1100/user                                 : 44                       
/DEVICE/1200/default_user                         : none                     
/DEVICE/1200/dial                                 : SIP/1200                 
/DEVICE/1200/type                                 : adhoc                    
/DEVICE/1200/user                                 : 03                       
/DEVICE/18322707758/user                          : none                     
/DEVICE/2000/default_user                         : 2000                     
/DEVICE/2000/dial                                 : SIP/2000                 
/DEVICE/2000/type                                 : adhoc                    
/DEVICE/2000/user                                 : 2010                     
/DEVICE/2001/default_user                         : none                     
/DEVICE/2001/dial                                 : SIP/2001                 
/DEVICE/2001/type                                 : adhoc                    
/DEVICE/2001/user                                 : none                     
/DEVICE/2002/default_user                         : none                     
/DEVICE/2002/dial                                 : SIP/2002                 
/DEVICE/2002/type                                 : adhoc                    
/DEVICE/2002/user                                 : none                     
/DEVICE/2003/default_user                         : none                     
/DEVICE/2003/dial                                 : SIP/2003                 
/DEVICE/2003/type                                 : adhoc                    
/DEVICE/2003/user                                 : none                     
/DEVICE/204/default_user                          : 204                      
/DEVICE/204/dial                                  : SIP/204                  
/DEVICE/204/type                                  : adhoc                    
/DEVICE/204/user                                  : 204                      
/DEVICE/205/default_user                          : 205                      
/DEVICE/205/dial                                  : SIP/205                  
/DEVICE/205/type                                  : adhoc                    
/DEVICE/205/user                                  : none                     
/DEVICE/user                                      : none

The database back end has changed recently, so the Asterisk version is important. For the older astdb, just stopping asterisk, deleting astdb, and restarting will clear it of all persistent data. If you need to selectively delete, you will probably have to write a small program.

Thanks for the reply, does your statement apply for the version that machine is running? It’s:
Asterisk 1.4.22-4

1.4 is obsolete, and therefore uses the old astdb mechanism that I described.