Limiting Call Concurrency for Campaigns
# support
y
Hello, I would like to know if it is possible to intentionally set a limit for how many concurrent calls a specific campaign can use? In my use case my Vapi account has a limit of 11 concurrency calls. I plan to run a multi-user platform but with a single Vapi account in the background. If 1 user launches a campaign with 100 calls then they will take up all of the call concurrency for the other users that also want to create campaigns simultaneously. What I would like to do is be able to limit how many concurrent calls a campaign can run, this would let me limit each campaign to 1-2 concurrent calls at once, thus allowing more users to run their campaigns simultaneously on my platform. Is this possible at the moment or something you are looking into implementing?
v
You can implement per-campaign concurrency limits by tracking active calls for each campaign in Redis and only processing new calls when the campaign's limit is not exceeded. Here’s a simplified example:
Copy code
js
// Check and increment campaign concurrency
async function canProcessCampaignCall(campaignId, maxCampaignConcurrency) {
  const key = `campaign:${campaignId}:active_calls`;
  const active = await redisClient.get(key) || 0;
  if (active < maxCampaignConcurrency) {
    await redisClient.incr(key);
    return true;
  }
  return false;
}
Use this check before dequeuing or starting a new call for a campaign. Decrement the counter when a call ends. For more details, see the [Vapi call queue management guide](https://docs.vapi.ai/calls/call-queue-management). Source: - [Call queue management with Twilio](https://docs.vapi.ai/calls/call-queue-management)
y
I would prefer if it was a parameter that you passed when creating the campaign instead of having to implement the logic on my own.
c
If you would like to see that feature on our platform, feel free to add it to the feature request list here -->
m
Can this also be used with BYO SIP trunk setup?
c
Yes this can be done on BYO SIP trunks
m
do you have some more info/docs about this?
c
Sorry, I misinterpreted your original request. You can build out custom logic on your server to create a call queueing system which will act like a concurrency limiter. We currently only set limits for total concurrency for the org
3 Views