Asterisk Phonebook - Cleaning out entries


I’ve been running FreePBX for a while, and the number of entries in my “Asterisk Phonebook” is getting bigger!

Most of the entries are not assigned to names - and never will be.

Is their any easy way to delete all those without names associated with them? About 150 of them.

The reason for this is due to the delay in the calls being passed to the extensions. The caller can hear the phone ring 3 or 4 times before the extension rings, and it’s been suggested that the caller look up may be the reason.

Many thanks


If the total number of entries is all but a few hundred, I don’t think that is the reason. Having said so, you could check this by removing the lookup - temporarily - and see if the delay remains. Also, if your incoming lines are POTS then there will always be a delay from when the telco accepts the call till your hardware recognizes the ‘ring’. Finally, check to see if you have ‘fax detection’ enabled as this will NEED a delay to listen for fax tones.

The short way to ‘see’ the delay is to watch the cli.

I’m unsure as to where the data is held, but if you export to csv use you favorite spreadsheet or database application to clean it out then re import.

If you start asterisk console (asterisk -r) and type ‘database show cidname’ do you see all your phonebook entires?

If you do, you can erase them all by typing ‘database deltree cidname’

NOTE!!! Copy the /var/lib/asterisk/astdb so a safe place first, if you mess up deleting the wrong entires you can severely damage your setup.

Thanks for the replies.

I’ve checked that fax detection is off, but I can’t find where I turn off the cli look-up. I’m sure it’s somewhere obvious… but I can’t see it!

Please can someone point me in the right direction?

The call is from a BT (British Telecom) POTs line via a Sipura SPA3000 unit, via the Asterisk box, and the extensions are all analogue phones on a series of Linksys ATA’s.

Thanks again


CID Lookup is in ‘Inbound Routes’

Said it would be obvious!