Introduction

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

It has the following capabililties:

  • Run a telephony task on a specified date and time by making an outbound call to a destination and starting the application configured on a service number
  • Run a workflow task on a specified date and time by starting a background daemon process and running a workflow (GUI) application
  • Reschedule the task on completion for a time in the future
  • Retry the task if it fails to start or fails to complete
  • Start an error task (as a background process) if the task exceeds the maximum number of tries before it completes

Scheduling can be based on the following:

  • The date and time on which tasks should be run
  • Within specified opening times
  • Not on specified holidays

Tasks can be rescheduled (i.e. run repeatedly). Various options are available for this purpose.

Tasks can be passed parameters in JSON form. This enables several tasks to use the same service number configuration.

Rescheduling a task (if the task is configured as a repeating task) involves using the IVR / Workflow object Task Reschedule.

Configuration

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

The following fields can be configured in a task:

FieldSpecific to Task TypeDescription
Name
The 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).
DestinationTelephony ApplicationThis value is provided in the variable $caller, and is used as the number to dial for telephony processes. 
Service NumberTelephony ApplicationThe service number to use when making the outbound call for telephony processes. 
Next Scheduled
The date and time on which the task will be next scheduled. This is also used as the base for calculating the task reschedule date and time when it has run and the reschedule object in the IVR or workflow is used.
Opening Times
If configured, the task will only be run during the setup opening times. This can be used, for example, to prevent a recurring task running at night.
Holiday List
If configured, the task will only be run when it is not a holiday as specified in the holiday list. This can be used, for example, to prevent a recurring task running on holidays.
Maximum Tries
When the task is run and it does not pass through a Task Reschedule object in the workflow or IVR application, it will be tried again after one minute has expired. If the maximum number of tries is then reached, the workflow application specified in the "Routing Application (Maximum Tries Reached)" parameter is started, if configured.
Routing Application (Maximum Tries Reached)
If configured, this application will be started when the maximum number of tries is reached and the task has not passed through a Task Reschedule object.
Reschedule every (minutes)

This parameter configures the repeating task interval. When the task has completed, or run to the error state due to the maximum number of tries being reached, the task is rescheduled if this parameter is configured. The following values are allowed:

  • 1 Minute
  • 2 Minutes
  • 3 Minutes
  • 4 Minutes
  • 5 Minutes
  • 10 Minutes
  • 15 Minutes
  • 30 Minutes
  • 1 Hour
  • 2 Hours
  • 3 Hours
  • 4 Hours
  • 8 Hours
  • 12 Hours
  • Daily
  • Weekly

Note, that if a task is configured with a maximum tries parameter which causes the reschedule interval to be exceeded if more tries are required, then (at least) one interval will be skipped when the task is rescheduled.

Example:

  • The task is configured to start at 13:00 with a reschedule interval of 5 minutes and maximum tries 10
  • The first time the task is run, it takes 6 tries to complete (this will take 6 minutes, as re-trying the task occurs every minute)
  • The next time the task will be scheduled for will be 13:10, as this is the next interval in the future at which the task could be rescheduled
Task Parameters (JSON)

The parameters specified here MUST be valid JSON. If you are not certain about this, then use an online JSON formatter to check the validity of the data. Here is an example of the parameters you might use:

{ 
"myParameter1":"This is the value of parameter 1",
"myParameter2":"PARAM2"
}

The configured parameters are passed to the task and will be parsed as JSON by the workflow / IVR engine and made available to the running task as variables with the prefix $params.

The example parameters above would be stored in the variables:

$params.myParameter1
$params.myParameter2
Comments
You can provide any comments / documentation necessary in this field, which is for informational purposes only.

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.

nMaxTriesINTEGERThe maximum number of repeat tries of performing 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:

  • No labels