Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

The task scheduler provides the capability to run tasks at scheduled times, optionally repeating them as required.

...

Tasks can be passed parameters in JSON form, and an error task can be scheduled to run if the task does not complete.

Configuration

The task scheduler can be configured via the menu item Routing ... Task Scheduler.

The following fields can be configured in a task:

FieldDescription
NameThe name of the task to be scheduled
Active

When set to checked (on), then the task is active. Only active tasks will be scheduled for running.

Type

The following types are supported:

  • Telephony Application. This type dials a telephone number and runs an application associated with a service number when the destination is reached.
  • Workflow Application. This type starts a background application running (i.e. a non voice application).
DestinationThis value is provided in the variable $caller, and is used as the number to dial in telephony processes. For background (workflow) applications, this is not used.


Task Control

The task scheduler uses the following fields to control how tasks are scheduled:

Field

Values

Comments

dtNextSchedule

TIMESTAMP

When the task should next be scheduled for.

Is updated when the task is rescheduled after running or repeating the max times.

nState

INTEGER

0 = READY to run (see dtNextSchedule for when)

10 = STARTING PROCESS (is in daemon being started)

20 = RUNNING (process is actually running)

-1 = RESCHEDULE (needs checking whether a reschedule is required)

-99 = DONE (job is finished and will not be rescheduled)

nCurrentTries

INTEGER

The current number of tries of starting the job.

dtStateChange

TIMESTAMP

Set when the state was changed, which enables recovery of abandoned / lost jobs.

Jobs which remain in a state for more than 5 minutes will be recovered as follows:

  • If the job is set to be rescheduled, then it will be rescheduled to the next time

  • If the job is not set to be rescheduled, then it will be moved to the error state

nRepeatingTaskInterval

INTEGER

Number of minutes to wait to reschedule the task again (repeating task).

State Diagram

Tasks are processed according to the following state diagram:

draw.io Diagram
bordertrue
diagramNameTask Scheduler State Diagram EN
simpleViewerfalse
width
linksauto
tbstyletop
lboxtrue
diagramWidth800
revision1