Import devices

Status
Not open for further replies.

RTL

New Member
Jan 26, 2024
28
0
1
63
Setting up a number of devices so tried importing. In order I imported users, extensions, devices then vm. All seems ok until I provision a handset. It works ok but the account is disabled.
Doing some digging on the template it seems to be that the 'enabled' setting passed to the templates is NULL not enabled. I can resolve this by opening and saving a device but that seems to defeat the whole purpose of import. Anyone come across this before?
The handsets are Grandstream GRP1612P fw 1.0.7.33
System information
1710332213243.png
 

RTL

New Member
Jan 26, 2024
28
0
1
63
Yes the field name is device_enabled' and after import the device shows as enabled. That is enabled shows as true. However as I said the device provisions with account 1 disabled.
Looking at the $account array passed to the provisioning template enabled is NULL

This is the relevant entry from the template
{foreach $account as $row}
<!-- Account {$row.line_number} General Settings -->

<!-- Account Active -->
<!-- Yes, No -->
<!-- Pvalue P271 -->
{if $row.enabled == 'true'}
<item name="account.{$row.line_number}.enable">Yes</item>
{else}
<item name="account.{$row.line_number}.enable">No</item>
{/if}


If I amend as below
{foreach $account as $row}
<!-- Account {$row.line_number} General Settings -->

<!-- Account Active -->
<!-- Yes, No -->
<!-- Pvalue P271 -->
{if $row.enabled == 'true'}
<item name="account.{$row.line_number}.enable">Yes</item>
{else}
<item name="account.{$row.line_number}.enable">No</item>
{/if}
$row.enabled evaluates to NULL or is empty
[sip_port] => 5060
[sip_transport] => tcp
[register_expires] => 2
[shared_line] =>
[enabled] =>
or

[sip_port] => 5060
[sip_transport] => tcp
[register_expires] => 2
[shared_line] =>
[enabled] =>
NULL
Therefore the account is not enabled.
I know I can override this by removing the condition and using
<item name="account.{$row.line_number}.enable">Yes</item>
but I'm mystified by this
 

whut

Member
Dec 23, 2022
228
22
18
I would try another similar model provisioning template to see if enabled get set correctly.
 

RTL

New Member
Jan 26, 2024
28
0
1
63
It's not the template that's the issue.
If you read my comments you can see that when users, extensions and devices are imported one or more of them are not enabled despite true being in the enabled field on the import.
You can see this from the conditional in the template

{if $row.enabled == 'true'}
<item name="account.{$row.line_number}.enable">Yes</item>
{else}
<item name="account.{$row.line_number}.enable">No</item>
{/if}

This works if $row.enabled == 'true'} but it isn't, it evaluates to NULL hence the account is not enabled.
The issue lies with the import process which doesn't seem to enable the device.
 
Status
Not open for further replies.