Does anyone have documentation or tooling to help migrate from a config file based asterisk deployment to a database deployment?
2 Answers
I don't have an automated migration script, but the gist is that you make with an extconfig.conf file that maps a traditional config file name to a table name (and set of MySQL or ODBC/DB credentials), and then a set of tables with slightly normalized (but nearly line-for-line) equivalents to what would be in a local config file. http://www.voip-info.org/wiki/view/Asterisk+RealTime has more.
Another way to do realtime database-backed call routing is using AGI or Fast AGI. We recommend AGI to our Asterisk hosting customers because it decouples call routing logic from phone/PBX functionality, something that's not at all true with an Asterisk dialplan (Asterisk RealTime or not). Your dialplan then uses the AGI command (with an agi:// URL) instead of calling embedded dialplan commands.
That also lets you write the call logic/routing in whatever programming language does the job best, which is rarely AEL. help.cloudvox.com has a bunch more AGI docs.
Troy
I was looking for the same thing and ended up writing my own quick and dirty script using Asterisk::config modules from CPAN, hope it saves sometime of somebody else:
#!/usr/bin/perl
use Asterisk::config;
my $rc = new Asterisk::config(file=>$ARGV[0]);
my $cols="";
my $vals="";
$parsed = $rc->fetch_sections_hashref();
foreach my $sec (sort keys %{$parsed})
{
$cols="name";
$vals="'$sec'";
while ( my ($c, $v) = each(%{$parsed->{$sec}}) )
{
$cols.= ",$c";
$vals.= ",'".join(',',@{$v})."'";
}
print "insert into mytable($cols) values($vals);\n";
}
print "\n\n";