Add PBX auto-attendant and office-hours CF targets

agranig/peering-route
Andreas Granig 12 years ago
parent ca3e92fbe1
commit acf36bde4b

@ -485,14 +485,16 @@ sub preferences_callforward :Chained('base') :PathPart('preferences/callforward'
$d = 'fax2mail';
} elsif($d =~ /\@conference\.local$/) {
$d = 'conference';
} elsif($d =~ /\@fax2mail\.local$/) {
$d = 'fax2mail';
} elsif($d =~ /^sip:callingcard\@app\.local$/) {
$d = 'callingcard';
} elsif($d =~ /^sip:callthrough\@app\.local$/) {
$d = 'callthrough';
} elsif($d =~ /^sip:localuser\@.+\.local$/) {
$d = 'localuser';
} elsif($d =~ /^sip:auto-attendant\@app\.local$/) {
$d = 'autoattendant';
} elsif($d =~ /^sip:office-hours\@app\.local$/) {
$d = 'officehours';
} else {
$duri = $d;
$d = 'uri';
@ -509,6 +511,17 @@ sub preferences_callforward :Chained('base') :PathPart('preferences/callforward'
$params->{ringtimeout} = $ringtimeout;
}
if($c->config->{features}->{cloudpbx}) {
my $pbx_pref = NGCP::Panel::Utils::Preferences::get_usr_preference_rs(
c => $c,
attribute => 'cloud_pbx',
prov_subscriber => $c->stash->{subscriber}->provisioning_voip_subscriber
);
if($pbx_pref->first) {
$c->stash->{pbx} = 1;
}
}
my $cf_form;
if($cf_type eq "cft") {
$cf_form = NGCP::Panel::Form::SubscriberCFTSimple->new(ctx => $c);
@ -577,6 +590,10 @@ sub preferences_callforward :Chained('base') :PathPart('preferences/callforward'
$d = "sip:callthrough\@app.local";
} elsif($d eq "localuser") {
$d = "sip:localuser\@app.local";
} elsif($d eq "autoattendant") {
$d = "sip:auto-attendant\@app.local";
} elsif($d eq "officehours") {
$d = "sip:office-hours\@app.local";
} elsif($d eq "uri") {
$d = $dest->field('uri')->field('destination')->value;
if($d !~ /\@/) {
@ -829,6 +846,17 @@ sub preferences_callforward_destinationset_create :Chained('base') :PathPart('pr
my $prov_subscriber = $c->stash->{subscriber}->provisioning_voip_subscriber;
if($c->config->{features}->{cloudpbx}) {
my $pbx_pref = NGCP::Panel::Utils::Preferences::get_usr_preference_rs(
c => $c,
attribute => 'cloud_pbx',
prov_subscriber => $c->stash->{subscriber}->provisioning_voip_subscriber
);
if($pbx_pref->first) {
$c->stash->{pbx} = 1;
}
}
my $form = NGCP::Panel::Form::DestinationSet->new(ctx => $c);
my $posted = ($c->request->method eq 'POST');
@ -877,6 +905,10 @@ sub preferences_callforward_destinationset_create :Chained('base') :PathPart('pr
$d = "sip:callthrough\@app.local";
} elsif($d eq "localuser") {
$d = "sip:localuser\@app.local";
} elsif($d eq "autoattendant") {
$d = "sip:auto-attendant\@app.local";
} elsif($d eq "officehours") {
$d = "sip:office-hours\@app.local";
} elsif($d eq "uri") {
$d = $dest->field('uri')->field('destination')->value;
# TODO: check for valid dest here
@ -936,6 +968,17 @@ sub preferences_callforward_destinationset_edit :Chained('preferences_callforwar
my $posted = ($c->request->method eq 'POST');
if($c->config->{features}->{cloudpbx}) {
my $pbx_pref = NGCP::Panel::Utils::Preferences::get_usr_preference_rs(
c => $c,
attribute => 'cloud_pbx',
prov_subscriber => $c->stash->{subscriber}->provisioning_voip_subscriber
);
if($pbx_pref->first) {
$c->stash->{pbx} = 1;
}
}
my $cf_preference = NGCP::Panel::Utils::Preferences::get_usr_preference_rs(
c => $c, prov_subscriber => $c->stash->{subscriber}->provisioning_voip_subscriber,
attribute => $cf_type,
@ -968,6 +1011,10 @@ sub preferences_callforward_destinationset_edit :Chained('preferences_callforwar
$d = 'callthrough';
} elsif($d =~ /^sip:localuser\@.+\.local$/) {
$d = 'localuser';
} elsif($d =~ /^sip:auto-attendant\@app\.local$/) {
$d = 'autoattendant';
} elsif($d =~ /^sip:office-hours\@app\.local$/) {
$d = 'officehours';
} else {
$duri = $d;
$d = 'uri';
@ -1042,6 +1089,10 @@ sub preferences_callforward_destinationset_edit :Chained('preferences_callforwar
$d = "sip:callthrough\@app.local";
} elsif($d eq "localuser") {
$d = "sip:localuser\@app.local";
} elsif($d eq "autoattendant") {
$d = "sip:auto-attendant\@app.local";
} elsif($d eq "officehours") {
$d = "sip:office-hours\@app.local";
} elsif($d eq "uri") {
$d = $dest->field('uri')->field('destination')->value;
# TODO: check for valid dest here

@ -61,6 +61,10 @@ sub build_destinations {
if($c->config->{features}->{callingcard});
push @options, { label => 'Call Trough', value => 'callthrough' }
if($c->config->{features}->{callthrough});
push @options, { label => 'Auto Attendant', value => 'autoattendant' }
if($c->config->{features}->{cloudpbx} && $c->stash->{pbx});
push @options, { label => 'Office Hours Announcement', value => 'officehours' }
if($c->config->{features}->{cloudpbx} && $c->stash->{pbx});
push @options, { label => 'Local Subscriber', value => 'localuser' }
if($c->config->{features}->{callthrough} || $c->config->{features}->{callingcard} );
}

@ -46,6 +46,10 @@ sub build_destinations {
if($c->config->{features}->{callingcard});
push @options, { label => 'Call Trough', value => 'callthrough' }
if($c->config->{features}->{callthrough});
push @options, { label => 'Auto Attendant', value => 'autoattendant' }
if($c->config->{features}->{cloudpbx} && $c->stash->{pbx});
push @options, { label => 'Office Hours Announcement', value => 'officehours' }
if($c->config->{features}->{cloudpbx} && $c->stash->{pbx});
push @options, { label => 'Local Subscriber', value => 'localuser' }
if($c->config->{features}->{callthrough} || $c->config->{features}->{callingcard} );
}

@ -65,6 +65,10 @@ sub destination_as_string {
return "CallThrough";
} elsif($dest =~ /^sip:localuser\@.+\.local$/) {
return "Local Subscriber";
} elsif($dest =~ /^sip:auto-attendant\@app\.local$/) {
return "Auto Attendant";
} elsif($dest =~ /^sip:office-hours\@app\.local$/) {
return "Office Hours Announcement";
} else {
my $d = $dest;
$d =~ s/sip:(.+)\@.+$/$1/;

Loading…
Cancel
Save