Last active
January 29, 2025 16:35
-
-
Save calanor/5cf5b51e7655f3c81e27c654aedec9a5 to your computer and use it in GitHub Desktop.
Asterisk. Remove unavailable contacts script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
contacts="$(asterisk -rx 'database show registrar/contact')" | |
while read -r line ; do | |
dbline=$(echo "$contacts" | grep ${line} | awk '{ print $1 }' | cut -d/ -f4 | cut -d: -f1) | |
echo Remove stuck contact: ${dbline} | |
asterisk -rx "database deltree registrar/contact ${dbline}" | |
done < <(asterisk -rx 'pjsip show contacts' | grep Unavail | awk '{ print $3}') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment