Bulk upload of Blacklist Numbers

pucky900

Joined
Feb 9, 2009
Messages
51
Likes
0
Points
0
#1
I'm currently trying to migrate from Trixbox CE to Elastix and trying to find an easy to move my blacklist of numbers to a new system without having to enter each one. I've dug into the Asterisk DB but never have found it's location. Help would be greatly appreciated.
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#2
They are maintained in the Asterisk berkeley database

you can get the old ones from the old machine with

rasterisk -x 'database show blacklist'

you can add them to the new one with

rasterisk -x 'database put blacklist <number> 1'

you can delete them with

rasterisk -x 'database del blacklist <NUMBER>'

write a shell script to do it quicker :)

perhaps something like this ugly but I hope functional (I never tried it ;) ) one liner run from the old machine:
Code:
rasterisk -x 'database show blacklist'|sed 's/^/rasterisk -x "database put /'|sed -s 's|/| |g'|sed 's/\s*://'|sed 's/$/"/' > xxx;ssh <new_machine_ip_or_name> sh  < xxx;rm -f xxx;ssh <new_machine_ip_or_name>  "rasterisk -x 'database show blacklist'"
ref:
man sed
man sh
man ssh
http://www.voip-info.org

dicko
 

pucky900

Joined
Feb 9, 2009
Messages
51
Likes
0
Points
0
#3
I actually found a super super easier way. All I need to do was to go into /var/lib/asterisk and copy the 'astdb' file from the old machine to my new one. Restarted my new machine and there they were.

Found it under the "Backup/Restore" section
http://www.voip-info.org/wiki/view/Asterisk+database
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,898
Messages
130,879
Members
17,560
Latest member
manuelc
Top