Skip to content

Instantly share code, notes, and snippets.

@peacefixation
Last active March 27, 2019 01:39
Show Gist options
  • Save peacefixation/646a00c7b7cb2ec40f6e109ed10a7ae5 to your computer and use it in GitHub Desktop.
Save peacefixation/646a00c7b7cb2ec40f6e109ed10a7ae5 to your computer and use it in GitHub Desktop.
Remove keys from Asterisk database
# remove each family of keys that match the specified pattern from the Asterisk database
# 4 digits
FAMILY_PATTERN="[0-9][0-9][0-9][0-9]"
for FAMILY in `asterisk -rx "database show" | cut -d' ' -f1 | egrep -a "/${FAMILY_PATTERN}/" | cut -d'/' -f2 | uniq`; do
asterisk -rx "database deltree ${FAMILY}";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment