diff --git a/lib/NGCP/Panel/Controller/API/PbxDeviceModels.pm b/lib/NGCP/Panel/Controller/API/PbxDeviceModels.pm
index b2bdad8ab5..acc3d8e268 100644
--- a/lib/NGCP/Panel/Controller/API/PbxDeviceModels.pm
+++ b/lib/NGCP/Panel/Controller/API/PbxDeviceModels.pm
@@ -22,7 +22,7 @@ __PACKAGE__->set_config({
}
});
-# curl -v -X POST --user $USER --insecure -F front_image=@sandbox/spa504g-front.png -F mac_image=@sandbox/spa504g-back.png -F front_thumbnail=@sandbox/spa504g-front-small.png -F json='{"reseller_id":1, "vendor":"Cisco", "model":"SPA999", "linerange":[{"name": "Phone Keys", "can_private":true, "can_shared":true, "can_blf":true, "keys":[{"labelpos":"top", "x":5110, "y":5120},{"labelpos":"top", "x":5310, "y":5320}]}]}' https://localhost:4443/api/pbxdevicemodels/
+# curl -v -X POST --user $USER --insecure -F front_image=@sandbox/spa504g-front.png -F mac_image=@sandbox/spa504g-back.png -F front_thumbnail=@sandbox/spa504g-front-small.png -F json='{"reseller_id":1, "vendor":"Cisco", "model":"SPA999", "linerange":[{"name": "Phone Keys", "can_private":true, "can_shared":true, "can_blf":true, "can_speeddial":true, "can_forward":true, "can_transfer":true, "keys":[{"labelpos":"top", "x":5110, "y":5120},{"labelpos":"top", "x":5310, "y":5320}]}]}' https://localhost:4443/api/pbxdevicemodels/
sub api_description {
return 'Specifies a model to be set in PbxDeviceConfigs. Use a Content-Type "multipart/form-data", provide front_image, front_thumbnail and mac_image parts with the actual images, and an additional json part with the properties specified below, e.g.: curl -X POST --user $USER -F front_image=@/path/to/front.png -F mac_image=@/path/to/mac.png -F front_thumbnail=@/path/to/front-small.png -F json=\'{"reseller_id":...}\' https://example.org:1443/api/pbxdevicemodels/ This resource is read-only to subscriberadmins.';
@@ -62,6 +62,9 @@ sub documentation_sample {
can_private => 1,
can_shared => 1,
can_blf => 1,
+ can_speeddial => 1,
+ can_forward => 1,
+ can_transfer => 1,
keys => [
{
x => 100,
diff --git a/lib/NGCP/Panel/Controller/Device.pm b/lib/NGCP/Panel/Controller/Device.pm
index 61cac70833..5381ba1b43 100644
--- a/lib/NGCP/Panel/Controller/Device.pm
+++ b/lib/NGCP/Panel/Controller/Device.pm
@@ -1003,6 +1003,9 @@ sub devprof_get_lines :Chained('devprof_base') :PathPart('lines/ajax') :Args(0)
{ name => 'can_private', search => 1, title => $c->loc('Private Line') },
{ name => 'can_shared', search => 1, title => $c->loc('Shared Line') },
{ name => 'can_blf', search => 1, title => $c->loc('BLF Key') },
+ { name => 'can_speeddial', search => 1, title => $c->loc('SpeedDial') },
+ { name => 'can_forward', search => 1, title => $c->loc('Forward') },
+ { name => 'can_transfer', search => 1, title => $c->loc('Transfer') },
]);
NGCP::Panel::Utils::Datatables::process($c, $resultset, $cols);
$c->detach( $c->view("JSON") );
diff --git a/lib/NGCP/Panel/Form/Customer/PbxFieldDevice.pm b/lib/NGCP/Panel/Form/Customer/PbxFieldDevice.pm
index 958018a4c5..5c6b37c7e9 100644
--- a/lib/NGCP/Panel/Form/Customer/PbxFieldDevice.pm
+++ b/lib/NGCP/Panel/Form/Customer/PbxFieldDevice.pm
@@ -93,8 +93,11 @@ sub validate_line_type {
$field->clear_errors;
unless($field->value eq 'private' ||
$field->value eq 'shared' ||
- $field->value eq 'blf') {
- my $err_msg = 'Invalid line type, must be private, shared or blf';
+ $field->value eq 'blf' ||
+ $field->value eq 'speeddial' ||
+ $field->value eq 'forward' ||
+ $field->value eq 'transfer') {
+ my $err_msg = 'Invalid line type, must be private, shared, blf, speeddial, forward or transfer';
$field->add_error($err_msg);
}
return;
diff --git a/lib/NGCP/Panel/Form/Customer/PbxFieldDeviceAPI.pm b/lib/NGCP/Panel/Form/Customer/PbxFieldDeviceAPI.pm
index f065217695..628c7482ca 100644
--- a/lib/NGCP/Panel/Form/Customer/PbxFieldDeviceAPI.pm
+++ b/lib/NGCP/Panel/Form/Customer/PbxFieldDeviceAPI.pm
@@ -47,7 +47,7 @@ has_field 'lines' => (
wrapper_class => [qw/hfh-rep-block/],
element_attr => {
rel => ['tooltip'],
- title => ["The lines for this pbx device. Required keys are 'linerange' (name of range to use), 'key_num' (key number in line range, starting from 0), 'type' (one of 'private', 'shared', 'blf'), 'subscriber_id' (the subscriber mapped to this key)."],
+ title => ["The lines for this pbx device. Required keys are 'linerange' (name of range to use), 'key_num' (key number in line range, starting from 0), 'type' (one of 'private', 'shared', 'blf', 'speeddial', 'forward', 'transfer'), 'subscriber_id' (the subscriber mapped to this key)."],
},
);
@@ -89,6 +89,9 @@ has_field 'lines.type' => (
{ label => "private", value => "private" },
{ label => "shared", value => "shared" },
{ label => "blf", value => "blf" },
+ { label => "speeddial", value => "speeddial" },
+ { label => "forward", value => "forward" },
+ { label => "transfer", value => "transfer" },
],
element_attr => {
rel => ['tooltip'],
diff --git a/lib/NGCP/Panel/Form/Device/Model.pm b/lib/NGCP/Panel/Form/Device/Model.pm
index 2b97e9ddca..cd4a58815e 100644
--- a/lib/NGCP/Panel/Form/Device/Model.pm
+++ b/lib/NGCP/Panel/Form/Device/Model.pm
@@ -111,7 +111,7 @@ has_field 'linerange' => (
wrapper_class => [qw/hfh-rep-block/],
element_attr => {
rel => ['tooltip'],
- title => ['An array of line/key definitions for this device. Each element is a hash containing the keys name, can_private, can_shared, can_blf and keys (which in turn is an array of hashes having x, y and labelpos allowing top, bottom, left right).'],
+ title => ['An array of line/key definitions for this device. Each element is a hash containing the keys name, can_private, can_shared, can_blf, can_speeddial, can_forward, can_transfer and keys (which in turn is an array of hashes having x, y and labelpos allowing top, bottom, left right).'],
},
);
@@ -159,6 +159,36 @@ has_field 'linerange.can_blf' => (
},
);
+has_field 'linerange.can_speeddial' => (
+ type => 'Boolean',
+ label => 'Supports Speeddial',
+ default => 0,
+ element_attr => {
+ rel => ['tooltip'],
+ title => ['Lines/Keys in this range can be used as speeddial. Value is accessible in the config template via phone.lineranges[].lines[].can_speeddial'],
+ },
+);
+
+has_field 'linerange.can_forward' => (
+ type => 'Boolean',
+ label => 'Supports Forward',
+ default => 0,
+ element_attr => {
+ rel => ['tooltip'],
+ title => ['Lines/Keys in this range can be used as forward. Value is accessible in the config template via phone.lineranges[].lines[].can_forward'],
+ },
+);
+
+has_field 'linerange.can_transfer' => (
+ type => 'Boolean',
+ label => 'Supports Transfer',
+ default => 0,
+ element_attr => {
+ rel => ['tooltip'],
+ title => ['Lines/Keys in this range can be used as transfer. Value is accessible in the config template via phone.lineranges[].lines[].can_transfer'],
+ },
+);
+
has_field 'linerange.keys' => (
type => 'Repeatable',
label => 'Key Definition',
diff --git a/lib/NGCP/Panel/Role/API/PbxDeviceModels.pm b/lib/NGCP/Panel/Role/API/PbxDeviceModels.pm
index 767865afaa..58746fcc5c 100644
--- a/lib/NGCP/Panel/Role/API/PbxDeviceModels.pm
+++ b/lib/NGCP/Panel/Role/API/PbxDeviceModels.pm
@@ -181,7 +181,7 @@ sub check_resource{
$self->error($c, HTTP_UNPROCESSABLE_ENTITY, "Invalid range definition inside linerange parameter, all must be hash");
return;
}
- foreach my $elem(qw/can_private can_shared can_blf keys/) {
+ foreach my $elem(qw/can_private can_shared can_blf can_speeddial can_forward can_transfer keys/) {
unless(exists $range->{$elem}) {
$c->log->error("missing mandatory attribute '$elem' in a linerange element");
$self->error($c, HTTP_UNPROCESSABLE_ENTITY, "Invalid range definition inside linerange parameter, missing attribute '$elem'");
@@ -237,7 +237,7 @@ sub process_range {
delete $r->{$f};
}
$r->{id} = int($r->{id});
- foreach my $f(qw/can_private can_shared can_blf/) {
+ foreach my $f(qw/can_private can_shared can_blf can_speeddial can_forward can_transfer/) {
$r->{$f} = $r->{$f} ? JSON::true : JSON::false;
}
$r->{keys} = [];
diff --git a/lib/NGCP/Panel/Utils/Device.pm b/lib/NGCP/Panel/Utils/Device.pm
index 7f3b6545ec..c6af8d2b4c 100644
--- a/lib/NGCP/Panel/Utils/Device.pm
+++ b/lib/NGCP/Panel/Utils/Device.pm
@@ -91,6 +91,9 @@ sub update_device_model_ranges {
$range->{can_private} //= 0;
$range->{can_shared} //= 0;
$range->{can_blf} //= 0;
+ $range->{can_speeddial} //= 0;
+ $range->{can_forward} //= 0;
+ $range->{can_transfer} //= 0;
$range_db->update($range);
}
} else {
@@ -116,7 +119,10 @@ sub update_device_model_ranges {
if($fielddev_line->key_num >= $range_db->num_lines ||
($fielddev_line->line_type eq 'private' && !$range_db->can_private) ||
($fielddev_line->line_type eq 'shared' && !$range_db->can_shared) ||
- ($fielddev_line->line_type eq 'blf' && !$range_db->can_blf)) {
+ ($fielddev_line->line_type eq 'blf' && !$range_db->can_blf) ||
+ ($fielddev_line->line_type eq 'speeddial' && !$range_db->can_speeddial) ||
+ ($fielddev_line->line_type eq 'forward' && !$range_db->can_forward) ||
+ ($fielddev_line->line_type eq 'transfer' && !$range_db->can_transfer)) {
$fielddev_line->delete;
}
diff --git a/sandbox/annotate.html b/sandbox/annotate.html
index f318cd0ad8..7a71b73fca 100644
--- a/sandbox/annotate.html
+++ b/sandbox/annotate.html
@@ -76,6 +76,9 @@
+
+
+
diff --git a/share/templates/customer/details.tt b/share/templates/customer/details.tt
index 5e9aaf0d52..b461cebf8b 100644
--- a/share/templates/customer/details.tt
+++ b/share/templates/customer/details.tt
@@ -1029,7 +1029,7 @@ function create_ranges_annotations(id,type,ranges){
[% END -%]
'' +
'