Wishlist: Telephony - eg-pbx-allocator.pl limit calls to a phone number per day

Bug #1516143 reported by Josh Stompro
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Evergreen
New
Wishlist
Unassigned

Bug Description

Hello, we would like the pbx-allocator.pl to be a little smarter about how often a patron gets called.

We want calls to go out quickly, so customers can get their items as soon as possible. But we don't want customers to get one call per copy that goes on the holdshelf for them that day.

So I would like to propose that the pbx-allocator.pl, the script that moves calls from the call file staging directory to the asterisk outgoing call folder keep track of which phone numbers it has queued, and delay new calls for x number of hours if the phone number has been seen in the last x hours.

For our purposes just tracking the phone number would be enough, we don't identify the patron in the phone message, so there is no reason to track the specific patron id.

So how it might work would be.

For each call file that the pbx-allocator moves to the outgoing folder, record the call file name, phone number, context and timestamp.

For each call file that the pbx-allocator considers for moving to the outgoing folder, check to see if the phone number and context are in the data file. If there is an entry, check if the call file name is the same (which would mean smart-retry is in use, allow it) If it is a different call for the same number and context, change the modification time of the call file so it will be reconsidered the next day.

When the script loads the data file, it can delete all entries that are expired and exclude them when it gets overwritten.

For a phase 2 project, I would like to see about combining call files that are for the same number. That could be a separate script that gets run before calls start for the day.

Josh
Lake Agassiz Regional Library
Northwest Regional Library

summary: - Wishlist: Telephony - eg-pbx-allocator.pl limit calls to a specific
- number per day
+ Wishlist: Telephony - eg-pbx-allocator.pl limit calls to a phone number
+ per day
Revision history for this message
Doug Kyle (dkyle) wrote :

You can generate a single call file for multiple related events via the group context field in the action trigger setup. For example, I group hold pickup calls by usr. I think you could add usr.day_phone to the trigger environment and group by that.

Revision history for this message
Josh Stompro (u-launchpad-stompro-org) wrote :

Thanks Doug, but the group context only groups events that are ready and valid at the point that action_trigger_runner.pl is run. So if we run action_trigger_runner every 30 minutes, and 4 items get checked in that go on the holdshelf for that usr, one every hour, then the patron will get 4 calls queued. If we only queued the hold pickup notices once a day, then it would work just fine. We might need to do this until a work around is created. We want to notify customers as soon as possible.

I think if we did try to group on the phone numbers, we would probably need to go by ahr.phone_notify since usr.day_phone isn't always what is used to populate that field.

I'm going to send you an email to ask you more about your setup.

Josh

Revision history for this message
Josh Stompro (u-launchpad-stompro-org) wrote :

I found an easier way to address this issue by looking at and modifying the pending events for our phone hold pickup event definition before the pending events are processed.

So this ticket can be closed, I'm not going to try and adjust the pbx-allocator scripts to do the same thing.

So before processing the pending items, we run a script that invalidates with a custom user_data value any pending events where a completed event exists for that same customer in the last 12 hours.

Then once a day, move all the invalid events back to pending status so they can get evaluated again.

I placed my scripts in a gist in case anyone else want to see them.
https://gist.github.com/stompro/c1795afd55d28289b4ecd7e325e80ea3

This method could also be used to attack the problem in other ways that might be useful.

1. Only place calls for a pickup location after no more items have been placed on that locations holdshelf for x number of minutes.

2. Only place calls for a specific user once no more new events have been created for x number of minutes.

Josh

tags: added: actiontrigger patron
removed: wishlist
Changed in evergreen:
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.