How to accept calls only during a specific block of time

General discussion of Ascendis Caller ID hints, tricks, configurations, etc.
Post Reply
bwm
Posts: 11
Joined: Tue Sep 15, 2009 9:31 am

How to accept calls only during a specific block of time

Post by bwm » Fri Oct 09, 2009 12:52 pm

Code: Select all

// LANGUAGE=DWS

// 20090914 - bwm Time of Day call handler.  When this action is assigned to a contact
// it will play a message and then hangup if the call is outside of the prescribed time window
// (single block of days, single block of time), otherwise it will let the call ring through.
//
// One use is to tell telemarketers to call back during a time when you aren't home so they
// have to leave a message on an answering machine.  If they call outside of the time/day time block
// when you are home, your phone only rings once.  Some telemarketer dialers can tell if an answering
// machine picks up, so I precede my message with a "Hello? ........ Hello?....." sound file to
// get the call transfered to an agent before the message to call back later is played.
//
// (requires hardware ability to play sound file over phone with phonesound() and a sound file of
// the message you want to play).

var CallDate: DateTime;
var CallTime: DateTime;
var TODStart: DateTime;
var TODStop: DateTime;
var DOWStart: Integer;
var DOWStop: Integer;
var AnnounceInWindow: String;
var AnnounceOutWindow: String;

// Set your time windows (inclusive; listed days will accept calls)
// DOW: 1=Sun, 2=Mon, 3=Tue, 4=Wed, 5=Thu, 6=Fri, 7=Sat
// TOD: HH:MM:SS xx format (xx is am or pm)

DOWStart := 2;
DOWStop := 5;
TODStart := StrToTime('9 am');
TODStop := StrToTime('4 pm');
AnnounceInWindow := '';
AnnounceOutWindow := 'CallBackM-R_9am-4pm_HangupsWillBePermanentlyBlocked.wav';

// Begin processing call
CallDate := Date;
CallTime := Time;

if &#40;DayOfWeek&#40;CallDate&#41; >= DOWStart&#41; and &#40;DayOfWeek&#40;CallDate&#41; <= DOWStop&#41; and &#40;CallTime >= TODStart&#41; and &#40;CallTime < TODStop&#41; then
  begin
  // Actions to occur within DOW, TOD window, if you want any
  // phonesound&#40;AnnounceInWindow&#41;;
  // hangup;
  end
else
  begin
  // Actions to occur outside of DOW, TOD window
  // Say 'Hello? ..." twice to get agent on the line
  phonesound&#40;'HelloX2.wav'&#41;;
  // Play the callback message twice
  phonesound&#40;AnnounceOutWindow&#41;;
  phonesound&#40;AnnounceOutWindow&#41;;
  hangup;
  end;

Post Reply