Howto:How to configure a nightly automatic phone restart via Devices app expert config

From innovaphone wiki
Jump to navigation Jump to search

Nightly automatic phone restart via Devices application expert configuration.

Problem description

Beeing able to restart a device automatically on a scheduled time

Applies To

IP Phones and Gateways that are registered to the Devices App

Concept

The expert configuration of the Devices app only runs once: after a device restart, or when the expert configuration is changed. That means it cannot schedule anything itself.

So the expert config only sets the phone’s update server URL (UP1) to a small script stored in the Files app. The phone downloads that script every 15 minutes. A times command inside the script makes sure the reset only happens in the chosen night hour.

Step 1 – Create the script nightly.txt

Upload this file to a shared folder in the Files app:

mod cmd UP1 times /allow 0 /initial 61
reset
Line Meaning
times /allow 0 The script only runs between 00:00 and 00:59. At any other time, processing stops right after this line.
/initial 61 Nothing runs during the first 61 minutes after a boot. After the reset at 00:xx, the next allowed hour is already over, so the phone does not loop.
reset Immediate restart, even during an active call. Use ireset instead to wait until the phone is idle.

Get the fileskey from the info (“i”) button of the shared folder in the Files app.

Step 2 – Devices app: expert configuration

Create a device configuration of type Expert configuration, assign it to the provisioning category of the phones, and enter:

config change UP1 /url https://<apps-host>/<domain>/files/UI/<folder>/nightly.txt&fileskey=<fileskey> /poll 15 /no-dhcp
config write
config activate
  • /poll 15: the phone polls the script every 15 minutes.
  • /no-dhcp: a URL handed out by DHCP cannot overwrite this URL.
  • Do not add iresetn, vars create or times to the expert config. They can cause a reboot loop or stop the expert config from running.

Step 3 – Prerequisites

  • The phone has a valid time from NTP. Without it, times cancels every execution.
  • The phone trusts the HTTPS certificate of the apps host.
  • The URL works in a browser and shows the two lines of the script.

Step 4 – Verify (optional)

  • Add /trace to the config change UP1 line.
  • In the phone’s Advanced UI, go to Maintenance → Diagnostics → Tracing, enable HTTP Client and open trace(continuous). There you can see the script being fetched and the server’s answer.
  • To test during the day, temporarily use the current hour and a small /initial value (e.g. /allow 16,17 /initial 1). The phone then restarts about every 15 minutes within those hours.
  • After testing, set the script back to /allow 0 /initial 61 and remove /trace.

Related Articles