Batching and collision avoidance
A common problem with using fax technology with a web application is that webapps move at the speed of the Internet, and faxes are constrained by the power of telephone networks. For many webapps that use fax, a common scenario arises that often results in big headaches for software developers: fax machines can only accept one call at a time, but your web application needs to send many files (be they restaurant orders, applications for government files, or insurance claims) within a very short period of time (i.e. less than the time it typically takes to complete one fax call.)
Imagine that you’re a restaurant ordering application. You’ll most likely receive the most orders between 2pm and 3pm 1, and many of those orders will be going to the same restaurants. Say you receive 12 orders at 1:45 pm that need to be filled by Joe’s Pizza by 2pm. You need to fax these orders off ASAP. Most likely your application fires faxes off as the orders are received. There’s only one problem: Joe’s Pizza only has one fax line, and you’re constantly receiving failures because your faxes are competing with each other to get through!
One solution might be to make sure you’re only sending one fax through at a time to a particular number and wait until any previous calls complete. First off, that’s a really annoying problem to have to solve - especially since you don’t do faxing, you do restaurant ordering! Additionally, if it takes 1 minute on average to send a fax, the final order will go through by 1:57 pm, leaving the restaurant only 3 minutes to prepare the order!
The Batching Solution
Phaxio lets you send faxes in “batches”. When you send a fax with the
parameter set, we won’t send your file as soon as you give it to us. Instead, we’ll wait
batch_delay seconds for more files to come in for the same phone number.
When the delay you specified has elapsed, we’ll fax all of the documents you sent us within that window in one phone call.
So in our restaurant ordering example above, the developer could specify
batch_delay=60 when sending
faxes with Phaxio. If all 12 orders are received in the same minute, they would all automatically be part of the same
“batch” to Joe’s Pizza and one call would be placed 60 seconds later with all of the orders! Amazing!
One step further:
The 12 page fax will take longer than one minute. What if your application tries to send another batch of files a minute after the 12 page call begins? We have another feature called collision avoidance that solves that problem.
If you specify
batch_collision_avoidance=true in your API call, Phaxio will
first check to see if another call is already occurring in our system to the target number. If so,
your batch will stay open and keep accepting files from your web application and ignore any attempts
by you to release the fax (via API, console, or time delay.) Once the conflicting call completes, Phaxio
will release your fax automatically and the call will begin.
1. What if I pass custom callback urls in for a fax that is in batching mode?
We will POST to all the callback urls you give us.
2. How can I tell that a fax is in batching mode?
The status for the fax will be `pendingbatch`.
3. Does collision avoidance look at all the calls being placed by Phaxio, or just the ones in my account?
All the calls currently being placed by Phaxio.