RT::Extension::SMSNotify::OnShift3pm
Enable notifications based on shifts
Overview
An example that uses a 'ShiftCode' custom field on users to look shift definitions up from the RT config file and return user phone numbers only if they are currently on shift.
Configuration
This module must be specified as a phone number lookup function by passing the module name. RT::Extension::SMSNotify will look for a function named "GetPhoneForUser" in the module as per the docs for $SMSNotifyGetPhoneForUserFn.
Set($SMSNotifyGetPhoneForUserFn, 'RT::Extension::SMSNotify::IsOnShift');
Now the RT config $SMSNotifyShiftMap must be set to a hashref pointing to a hash where the shift names are keys and the values are arrayrefs pointing to two-element arrays of integers. Each key is a shift code that matches the ShiftCode custom field values. Both values are integers representing minutes since midnight UTC and are in the range 0 <= x < 1440. For example:
Set($SMSNotifyShiftMap, {'AU' => [22*60+0, 4*60+0],'UK' => [8*60+30, 17*60+30]});
Be careful to avoid leading zeroes, since Perl will interpret the value as octal:
$ perl -e 'print 0600 . "\n"';384
At this point there's no provision for special notification rules if no users are found on shift, since the filter function only sees one user at a time. Make sure you define your shifts and user assignments carefully.
Releases
4 releases since Debian 9 (Stretch); the text changed 1 time.