Jump to: navigation, search

Customer Contact According to Daytime Intervals

You can design a treatment script that takes into account the time of day when determining how to contact a customer. Using predefined daytime intervals and configured Statistical Days and Statistical Tables with a SCXML treatment, OCS can also adjust how a customer is contacted if a daytime switch occurs. For example, the treatment may request that OCS dial a customer's business phone during business hours, but dial the customer's mobile phone after business hours.

The predefined daytime intervals include:

  • BH: Business hours on a weekday, from its start time to its end time.
  • ABH: After business hours on a weekday, from the end time of a weekday until midnight.
  • BBH: Before business hours on a weekday, from midnight to the start time of the weekday.
  • WEND: Weekend. Days that are identified by those days not configured as weekdays in the Weekday Statistical Days Table.
  • HDAY: Holiday. Days configured as holidays.

When a dialing session/campaign group loads, OCS reads the time intervals, Statistical Days, and Statistical Tables configuration to determine the current time interval. OCS looks for the Statistical Tables in the configuration database in the following order:

  • Under the Campaign Group Tenant.
  • Under the Environment Tenant, if it is not found under the Campaign Group Tenant.
Note: If these Statistical Tables are not found in either location or a Statistical Day is not configured, OCS considers the time range as a holiday (HDAY).

At startup, OCS determines the time and identifies the daytime interval according to the configured Statistical Days and Statistical Tables (see the procedure Configuring Statistical Days and Statistical Tables for Time Ranges). OCS dynamically processes configuration time interval changes (for example, from BH to ABH), while a Campaign Group is active. When the daytime interval changes, according to the contact's time zone, OCS informs the various instances of the state machine by sending the ocs.daytime_change event (see the Events from OCS table). This triggers the state machine to proceed to the new daytime interval.

In addition, when the SCXML engine downloads a script, the state machine requests the current daytime interval through the get_daytime action (see the Events from OCS table).

Script Design

When designing your SCXML treatment to handle daytime intervals and switching, include the following:

  • Each daytime interval and transition associated with changing from one interval to another.
  • For each interval, design the logic for making a call, and for handling call states, number of attempts, delays, and so on.
  • Define variables (data model) to represent different parameters/values (for example, contact type, delay, number of attempts, and so on) that will be used through the script. The value for these variables can also be specified in the treatment-uri option.

You can also configure the script to delay switching of time intervals if the daytime switch occurs while a particular substate is still being processed (for example, the state machine is waiting for the ocs.callresult event). To accomplish this, configure the script to store the daytime interval in a variable and have the script check that variable when it is in a state for processing a daytime change.

To simplify the script design, you might create one high level script and multiple individual scripts to handle each daytime interval. When the daytime switching occurs, the current time interval script will be stopped and the new daytime interval script started. Then in the high level script, include a reference in the script to an external file located at another URL using the src attribute. For example:
<state id="ABH" src="someURL#ABH">

When OCS requests a download of the script, the SCXML engine downloads the script and all referenced scripts into one combined state machine. As usual, an instance of this is created for each record/chain processed.

Note: For an example of a script which handles daytime intervals, see the sample treatment script, sample03.scxml, that installs with OCS.
This page was last edited on April 6, 2020, at 18:30.
Comments or questions about this documentation? Contact us for support!