diff --git a/lib/NGCP/Panel/Controller/API/Root.pm b/lib/NGCP/Panel/Controller/API/Root.pm index 2bf050f77a..62d6d41742 100644 --- a/lib/NGCP/Panel/Controller/API/Root.pm +++ b/lib/NGCP/Panel/Controller/API/Root.pm @@ -222,7 +222,7 @@ sub get_collection_properties { $name = 'primary_number'; } elsif($f->type =~ /AliasNumber/) { $name = 'alias_numbers'; - } elsif($f->type !~ /Regex|EmailList|SubscriberStatusSelect|SubscriberLockSelect|Identifier/) { + } elsif($f->type !~ /Regex|EmailList|SubscriberStatusSelect|SubscriberLockSelect|Identifier|PosInteger/) { $name .= '_id'; } } diff --git a/lib/NGCP/Panel/Form/Subscriber/SubscriberAPI.pm b/lib/NGCP/Panel/Form/Subscriber/SubscriberAPI.pm index ebb005e7e2..0de60fc234 100644 --- a/lib/NGCP/Panel/Form/Subscriber/SubscriberAPI.pm +++ b/lib/NGCP/Panel/Form/Subscriber/SubscriberAPI.pm @@ -26,7 +26,7 @@ has_field 'alias_numbers' => ( wrapper_class => [qw/hfh-rep/], element_attr => { rel => ['tooltip'], - title => ['Additional E.164 numbers (each containing a cc, ac and sn attribute) mapped to this subscriber for inbound calls.'] + title => ['Additional E.164 numbers (each containing a cc, ac and sn attribute) mapped to this subscriber for inbound calls.'], }, ); @@ -35,7 +35,7 @@ has_field 'lock' => ( label => 'Lock Level', element_attr => { rel => ['tooltip'], - title => ['The lock level of the subscriber.'] + title => ['The lock level of the subscriber.'], }, ); @@ -45,7 +45,7 @@ has_field 'is_pbx_group' => ( default => 0, element_attr => { rel => ['tooltip'], - title => ['Whether this subscriber is used as PBX group.'] + title => ['Whether this subscriber is used as PBX group.'], }, ); @@ -54,7 +54,27 @@ has_field 'pbx_group' => ( label => 'PBX Group', element_attr => { rel => ['tooltip'], - title => ['The PBX group id this subscriber belongs to.'] + title => ['The PBX group id this subscriber belongs to.'], + }, +); + +has_field 'pbx_hunt_policy' => ( + type => 'Select', + options => [ + { value => 'serial', label => 'serial'}, + { value => 'parallel', label => 'parallel'}, + ], + element_attr => { + rel => ['tooltip'], + title => ["'serial' or 'parallel'."], + }, +); + +has_field 'pbx_hunt_timeout' => ( + type => '+NGCP::Panel::Field::PosInteger', + element_attr => { + rel => ['tooltip'], + title => ['Serial Hunting Timeout'], }, ); @@ -64,7 +84,7 @@ has_field 'profile' => ( validate_when_empty => 0, element_attr => { rel => ['tooltip'], - title => ['The profile defining the actual feature set for this subscriber.'] + title => ['The profile defining the actual feature set for this subscriber.'], }, ); @@ -100,6 +120,7 @@ sub update_fields { if($c->config->{security}->{password_web_autogenerate}) { $self->field('webpassword')->required(0); } + return; } 1; diff --git a/lib/NGCP/Panel/Role/API/Subscribers.pm b/lib/NGCP/Panel/Role/API/Subscribers.pm index 36f95e28e3..4a0b2a2240 100644 --- a/lib/NGCP/Panel/Role/API/Subscribers.pm +++ b/lib/NGCP/Panel/Role/API/Subscribers.pm @@ -37,6 +37,10 @@ sub resource_from_item { delete $resource{is_pbx_group}; delete $resource{pbx_group_id}; } + unless($resource{is_pbx_group}) { + delete $resource{pbx_hunt_policy}; + delete $resource{pbx_hunt_timeout}; + } delete $resource{contact_id}; if($item->contact) { $resource{email} = $item->contact->email; @@ -229,8 +233,6 @@ sub prepare_resource { form => $form, ); - use Data::Printer; p $resource; - unless($domain) { $domain = $c->model('DB')->resultset('domains')->search($resource->{domain_id}); if($c->user->roles eq "admin") {