RT::Ex...OnShift(3pm)
π RT::Extension::SMSNotify::IsOnShift β bestie edition π
okay so this is a page from the User Contributed Perl Documentation for the module RT::Extension::SMSNotify::IsOnShift, and yes the name is long, she's a whole mouthful, we love her anyway π«Ά
β¨ NAME β¨
RT::Extension::SMSNotify::IsOnShift β enabling notifications based on shifts π
πΈ DESCRIPTION πΈ
It's giving example module, and here's the tea: it uses a 'ShiftCode' custom field on users to look shift definitions up from the RT config file, and it returns user phone numbers only if they are currently on shift. That's it, that's the whole vibe. π₯
π CONFIGURATION π
okay so first things first: this module has to be specified as a phone number lookup function by passing the module name. RT::Extension::SMSNotify will go looking for a function named "GetPhoneForUser" inside the module, exactly as per the docs for $SMSNotifyGetPhoneForUserFn. like so:
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 the 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 of those values are integers representing minutes since midnight UTC, and they live in the range 0 <= x < 1440. for example:
Set($SMSNotifyShiftMap, {
'AU' => [22*60+0, 4*60+0],
'UK' => [8*60+30, 17*60+30]
});
β οΈ bestie PLEASE be careful to avoid leading zeroes, because Perl will interpret the value as octal. not a drill. not a vibe. just pain: $ perl -e 'print 0600 . "\n"'; 384
and ngl, 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. so make sure you define your shifts and your user assignments carefully, okay? π the code cannot read your mind, she can only read one user.
π AUTHOR π
Craig Ringer <craig@2ndquadrant.com>
π COPYRIGHT π
Copyright 2013 2ndQuadrant
Released under the same license as Perl its self.
π¦ GetPhoneForUser π¦
Look up the PagerPhone field of the specified user and return it only if the user is currently on shift according to their 'ShiftCode' custom field as looked up in the RT configuration 'SMSNotifyShiftMap'. iconic behaviour tbh.
See the configuration section and RT::Extension::SMSNotify. π
and that's the whole page, bestie β courtesy of perl v5.36.0, dated 2023-09-25, from the User Contributed Perl Documentation collection. go forth and schedule your shifts responsibly πβ¨ππ¦πΈπ π«Άπ
π¦ where this page comes from
- ubuntu noble: rt4-extension-smsnotify 1.04-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms