smeserver-freepbx/root/etc/e-smith/db/configuration/migrate/freepbx

47 lines
1.5 KiB
Plaintext
Raw Normal View History

{
my $freepbx = $DB->get('freepbx') || $DB->new_record('freepbx', {type => 'service'});
my $dbpass = $freepbx->prop('DbPassword') ||
$freepbx->set_prop('DbPassword', `/usr/bin/openssl rand -base64 40 | /usr/bin/tr -c -d '[:graph:]'`);
my $managerpass = $freepbx->prop('ManagerPassword') ||
$freepbx->set_prop('ManagerPassword', `/usr/bin/openssl rand -base64 10 | /usr/bin/tr -c -d '[:alnum:]'`);
my $aripass = $freepbx->prop('AriPassword') ||
$freepbx->set_prop('AriPassword', `/usr/bin/openssl rand -base64 10 | /usr/bin/tr -c -d '[:alnum:]'`);
# FOP not compatible with latest astersisk
my $fop = $DB->get("fop");
$fop->delete if $fop;
# with freepbx 13, we have a new port
my $UDPPorts = $freepbx->prop('UDPPorts') || '5060,5061,5160,5161,4569,10000:20000';
my @UDPlist= split(',',$UDPPorts);
unless ('5061' ~~ @UDPlist){
$UDPPorts = "$UDPPorts,5061";
$freepbx->set_prop('UDPPorts',$UDPPorts);
}
unless ('5160' ~~ @UDPlist){
$UDPPorts = "$UDPPorts,5160";
$freepbx->set_prop('UDPPorts',$UDPPorts);
}
unless ('5161' ~~ @UDPlist){
$UDPPorts = "$UDPPorts,5161";
$freepbx->set_prop('UDPPorts',$UDPPorts);
}
if ('10000-20000' ~~ @UDPlist){
$UDPPorts =~ s/,10000-20000//;
$UDPPorts = "$UDPPorts,10000:20000";
$freepbx->set_prop('UDPPorts',$UDPPorts);
}
if ('1000-2000' ~~ @UDPlist){
$UDPPorts =~ s/,1000-2000//;
$freepbx->set_prop('UDPPorts',$UDPPorts);
}
}
#remove DeviceAndUser property
my $DeviceAndUser = $freepbx->prop('DeviceAndUser');
$frepbx->delete_prop('DeviceAndUser') if defined $DeviceAndUser;