|
|
|
|
@ -693,17 +693,11 @@ sub update_preferences : Local {
|
|
|
|
|
$fw_target =~ s/^sip://i;
|
|
|
|
|
|
|
|
|
|
if($fw_target =~ /^\+?\d+$/) {
|
|
|
|
|
if($fw_target =~ /^\+[1-9][0-9]+$/) {
|
|
|
|
|
} elsif($fw_target =~ /^00[1-9][0-9]+$/) {
|
|
|
|
|
$fw_target =~ s/^00/+/;
|
|
|
|
|
} elsif($fw_target =~ /^0[1-9][0-9]+$/) {
|
|
|
|
|
$fw_target =~ s/^0/'+'.$c->session->{subscriber}{cc}/e;
|
|
|
|
|
} elsif($fw_target =~ /^[1-9][0-9]+$/) {
|
|
|
|
|
$fw_target = '+' . $c->session->{subscriber}{cc} . $c->session->{subscriber}{ac} . $fw_target;
|
|
|
|
|
} else {
|
|
|
|
|
$messages{$fwtype} = 'Client.Voip.MalformedNumber';
|
|
|
|
|
$fw_target = $c->request->params->{$fwtype .'_sipuri'};
|
|
|
|
|
}
|
|
|
|
|
$fw_target = admin::Utils::get_qualified_number_for_subscriber($c, $fw_target);
|
|
|
|
|
my $checkresult;
|
|
|
|
|
return unless $c->model('Provisioning')->call_prov( $c, 'voip', 'check_E164_number', $fw_target, \$checkresult);
|
|
|
|
|
$messages{$fwtype} = 'Client.Voip.MalformedNumber'
|
|
|
|
|
unless $checkresult;
|
|
|
|
|
} elsif($fw_target =~ /^[a-z0-9&=+\$,;?\/_.!~*'()-]+\@[a-z0-9.-]+$/i) {
|
|
|
|
|
$fw_target = 'sip:'. lc $fw_target;
|
|
|
|
|
} elsif($fw_target =~ /^[a-z0-9&=+\$,;?\/_.!~*'()-]+$/) {
|
|
|
|
|
@ -733,16 +727,11 @@ sub update_preferences : Local {
|
|
|
|
|
|
|
|
|
|
$$preferences{cli} = $c->request->params->{cli} or undef;
|
|
|
|
|
if(defined $$preferences{cli} and $$preferences{cli} =~ /^\+?\d+$/) {
|
|
|
|
|
if($$preferences{cli} =~ /^\+[1-9][0-9]+$/) {
|
|
|
|
|
} elsif($$preferences{cli} =~ /^00[1-9][0-9]+$/) {
|
|
|
|
|
$$preferences{cli} =~ s/^00/+/;
|
|
|
|
|
} elsif($$preferences{cli} =~ /^0[1-9][0-9]+$/) {
|
|
|
|
|
$$preferences{cli} =~ s/^0/'+'.$c->session->{subscriber}{cc}/e;
|
|
|
|
|
} elsif($$preferences{cli} =~ /^[1-9][0-9]+$/) {
|
|
|
|
|
$$preferences{cli} = '+' . $c->session->{subscriber}{cc} . $c->session->{subscriber}{ac} . $$preferences{cli};
|
|
|
|
|
} else {
|
|
|
|
|
$messages{cli} = 'Client.Voip.MalformedNumber';
|
|
|
|
|
}
|
|
|
|
|
$$preferences{cli} = admin::Utils::get_qualified_number_for_subscriber($c, $$preferences{cli});
|
|
|
|
|
my $checkresult;
|
|
|
|
|
return unless $c->model('Provisioning')->call_prov( $c, 'voip', 'check_E164_number', $$preferences{cli}, \$checkresult);
|
|
|
|
|
$messages{cli} = 'Client.Voip.MalformedNumber'
|
|
|
|
|
unless $checkresult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$$preferences{clir} = $c->request->params->{clir} ? 1 : undef;
|
|
|
|
|
@ -1273,14 +1262,7 @@ sub do_edit_speed_dial_slots : Local {
|
|
|
|
|
my $checkadd_destination;
|
|
|
|
|
my $destination;
|
|
|
|
|
if ($add_destination =~ /^\+?\d+$/) {
|
|
|
|
|
if($add_destination =~ /^\+[1-9][0-9]+$/) {
|
|
|
|
|
} elsif($add_destination =~ /^00[1-9][0-9]+$/) {
|
|
|
|
|
$add_destination =~ s/^00/+/;
|
|
|
|
|
} elsif($add_destination =~ /^0[1-9][0-9]+$/) {
|
|
|
|
|
$add_destination =~ s/^0/'+'.$c->session->{subscriber}{cc}/e;
|
|
|
|
|
} elsif($add_destination =~ /^[1-9][0-9]+$/) {
|
|
|
|
|
$add_destination = '+' . $c->session->{subscriber}{cc} . $c->session->{subscriber}{ac} . $add_destination;
|
|
|
|
|
}
|
|
|
|
|
$add_destination = admin::Utils::get_qualified_number_for_subscriber($c, $add_destination);
|
|
|
|
|
my $checkresult;
|
|
|
|
|
return unless $c->model('Provisioning')->call_prov( $c, 'voip', 'check_E164_number', $add_destination, \$checkresult);
|
|
|
|
|
$destination = 'sip:'. $add_destination .'@'. $c->session->{subscriber}{domain}
|
|
|
|
|
@ -1344,14 +1326,7 @@ sub do_edit_speed_dial_slots : Local {
|
|
|
|
|
my $checkupdate_destination;
|
|
|
|
|
my $destination;
|
|
|
|
|
if ($update_destination =~ /^\+?\d+$/) {
|
|
|
|
|
if($update_destination =~ /^\+[1-9][0-9]+$/) {
|
|
|
|
|
} elsif($update_destination =~ /^00[1-9][0-9]+$/) {
|
|
|
|
|
$update_destination =~ s/^00/+/;
|
|
|
|
|
} elsif($update_destination =~ /^0[1-9][0-9]+$/) {
|
|
|
|
|
$update_destination =~ s/^0/'+'.$c->session->{subscriber}{cc}/e;
|
|
|
|
|
} elsif($update_destination =~ /^[1-9][0-9]+$/) {
|
|
|
|
|
$update_destination = '+' . $c->session->{subscriber}{cc} . $c->session->{subscriber}{ac} . $update_destination;
|
|
|
|
|
}
|
|
|
|
|
$update_destination = admin::Utils::get_qualified_number_for_subscriber($c, $update_destination);
|
|
|
|
|
my $checkresult;
|
|
|
|
|
return unless $c->model('Provisioning')->call_prov( $c, 'voip', 'check_E164_number', $update_destination, \$checkresult);
|
|
|
|
|
$destination = 'sip:'. $update_destination .'@'. $c->session->{subscriber}{domain}
|
|
|
|
|
@ -1533,14 +1508,7 @@ sub do_edit_destlist : Local {
|
|
|
|
|
if(defined $add) {
|
|
|
|
|
my $checkresult;
|
|
|
|
|
if($add =~ /^\+?\d+$/) {
|
|
|
|
|
if($add =~ /^\+[1-9][0-9]+$/) {
|
|
|
|
|
} elsif($add =~ /^00[1-9][0-9]+$/) {
|
|
|
|
|
$add =~ s/^00/+/;
|
|
|
|
|
} elsif($add =~ /^0[1-9][0-9]+$/) {
|
|
|
|
|
$add =~ s/^0/'+'.$c->session->{subscriber}{cc}/e;
|
|
|
|
|
} else {
|
|
|
|
|
$add = '+' . $c->session->{subscriber}{cc} . $c->session->{subscriber}{ac} . $add;
|
|
|
|
|
}
|
|
|
|
|
$add = admin::Utils::get_qualified_number_for_subscriber($c, $add);
|
|
|
|
|
return unless $c->model('Provisioning')->call_prov( $c, 'voip', 'check_E164_number', $add, \$checkresult);
|
|
|
|
|
} else {
|
|
|
|
|
return unless $c->model('Provisioning')->call_prov( $c, 'voip', 'check_email', $add, \$checkresult);
|
|
|
|
|
|