TT#141802 use proper SNOM param 'setting_server' on SRAPS

For some reason SNOM SRAPS has two parameters with
identical 'param_name'='setting_server':
 * "Settings Server URL"
 * "Settings Server"

NGCP need to use the second one on SRAPS to set device redirect URL.
We were receiving it by luck in the past.

The commit e548057d4 introduced performance improvement to 'last'
the search in loop after finding the proper 'param_name'.
As a result of improvement we set wrong option on SRAPS.

Dump of options for the history:

 * "Settings Server URL":
>{
> 'links' => {
>   'self' =>  'https://secure-provisioning.snom.com/api/v1/settings/5683038cec6c4fa9be95b2de9d1750e8',
>   'group' => 'https://secure-provisioning.snom.com/api/v1/setting-groups/8ab9230acf3f4060868509a93ad53f3f'
> },
> 'attrs' => [],
> 'choices' => undef,
> 'default_value' => undef,
> 'description' => undef,
> 'field_type' => 'url',
> 'fkey' => $VAR1->{'indexed'}{'enabled'},
> 'group' => '8ab9230acf3f4060868509a93ad53f3f',
> 'multiple' => $VAR1->{'indexed'}{'enabled'},
> 'name' => 'Setting Server URL',
> 'no_profiles' => 164,
> 'param_name' => 'setting_server',
> 'product_groups' => ['6cdbd3dfe5fe40e28c909f118a509b8a'],
> 'section' => 'global',
> 'sortable' => $VAR1->{'indexed'}{'enabled'},
> 'uses_permissions' => $VAR1->{'indexed'}{'enabled'},
> 'uuid' => '5683038cec6c4fa9be95b2de9d1750e8',
> 'indexed' => {
>   'default_size' => 4,
>   'max_size' => 0,
>   'start' => 0,
>   'enabled' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' )
> }
>}

 * "Settings Server":
>{
> 'links' => {
>   'self' => 'https://secure-provisioning.snom.com/api/v1/settings/50a400560eec4dc0b96b026094e06562',
>   'group' => 'https://secure-provisioning.snom.com/api/v1/setting-groups/8ab9230acf3f4060868509a93ad53f3f'
> },
> 'attrs' => [],
> 'choices' => undef,
> 'default_value' => undef,
> 'description' => 'Setting Server for Desk phones',
> 'field_type' => 'text',
> 'fkey' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
> 'group' => '8ab9230acf3f4060868509a93ad53f3f',
> 'multiple' => $VAR1->{'fkey'},
> 'name' => 'Setting Server',
> 'no_profiles' => 3189,
> 'param_name' => 'setting_server',
> 'product_groups' => ['1a45a2a3f6b94c4cbfa5439b446132f7'],
> 'section' => 'phone-settings',
> 'sortable' => $VAR1->{'fkey'},
> 'uses_permissions' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),
> 'uuid' => '50a400560eec4dc0b96b026094e06562',
> 'indexed' => {
>   'default_size' => 4,
>   'max_size' => 0,
>   'start' => 0,
>   'enabled' => $VAR1->{'fkey'}
> }
>};

The commit introduces the second filtering parameter 'section'='phone-settings',
as we cannot rely on any other parameters.

Change-Id: Iec2b2a0c2068efb90af20af3dba711dfc7f55ca8
Fixes: commit e548057d40
mr10.2
Alexander Lutay 4 years ago committed by Oleksandr Lutai
parent 68dcad8c70
commit f1e00a0408

@ -119,7 +119,9 @@ sub rest_prepare_request {
($data, $rc) = $self->send_http_request($c, $tx_id, $url, 'GET', $credentials);
if ($rc == 0 && $data && ref $data eq 'ARRAY') {
foreach my $setting (@$data) {
if ($setting->{param_name} eq 'setting_server') {
if ( ($setting->{param_name} eq 'setting_server') &&
($setting->{section} eq 'phone-settings') )
{
$setting_id = $setting->{uuid};
last;
}

Loading…
Cancel
Save