# Scheduling & Retry Logic

> Configure when and how campaign calls are made

Source: https://edesy.in/docs/voice-agent/campaigns/scheduling

Control when calls are made, how failures are handled, and how calls are distributed across multiple phone numbers.

> **Schedule campaigns:** [Open the Campaigns page](https://voice-agent.edesy.in/campaigns) to schedule campaigns and configure retry settings.

## Campaign Scheduling

### Immediate vs Scheduled Start

| Start Type | Description | Use Case |
|------------|-------------|----------|
| **Start Now** | Calls begin immediately | Testing, urgent campaigns |
| **Schedule** | Calls start at specified time | Planned outreach, time-sensitive campaigns |

### Scheduling a Campaign

1. Create campaign in **DRAFT** status
2. Click **Schedule** button
3. Select date and time (must be in future)
4. Campaign status changes to **SCHEDULED**

The campaign will automatically start at the scheduled time.

### Unscheduling

To cancel a scheduled campaign:

1. Find the campaign with **SCHEDULED** status
2. Click **Cancel Schedule** (or Unschedule)
3. Campaign returns to **DRAFT** status
4. Modify settings or schedule for different time

## Time Windows

Restrict calls to specific hours:

```
┌──────────────────────────────────────────────────────┐
│                   Call Time Window                    │
├──────────────────────────────────────────────────────┤
│                                                       │
│   00:00 ─────── 09:00 ═══════════ 18:00 ───── 23:59  │
│   ░░░░░░░░░░░░░ █████████████████ ░░░░░░░░░░░░░░░░░░ │
│   (blocked)     (allowed)         (blocked)          │
│                                                       │
│   Campaign pauses outside window, resumes next day    │
│                                                       │
└──────────────────────────────────────────────────────┘
```

### Configuration

| Setting | Description | Example |
|---------|-------------|---------|
| **Start Time** | Earliest time to call | `09:00` |
| **End Time** | Latest time to start call | `18:00` |
| **Timezone** | Local timezone for window | `Asia/Kolkata` |
| **Days of Week** | Which days to call | Mon-Fri |

### Behavior

- Calls only start within the time window
- Active calls complete even if window ends
- Campaign automatically pauses outside window
- Resumes on next valid day/time

## Retry Logic

Configure how failed calls are retried.

### Retryable Outcomes

| Outcome | Retry by Default | Description |
|---------|------------------|-------------|
| **No Answer** | Yes | Phone rang, no pickup |
| **Busy** | Yes | Line was busy |
| **Voicemail** | Yes | Went to voicemail |
| **Connected** | No | Call was answered |
| **Invalid Number** | No | Bad phone number |
| **DND Registered** | No | Do Not Disturb list |

### Retry Configuration

| Setting | Description | Default |
|---------|-------------|---------|
| **Max Attempts** | Total tries including first | 3 |
| **Retry Delay** | Base delay between retries | 30 min |
| **Backoff** | Increase delay each retry | Optional |

### Retry Timing

Default escalating delays:

| Attempt | Delay After |
|---------|-------------|
| 1st attempt | (immediate) |
| 2nd attempt | 30 minutes |
| 3rd attempt | 2 hours |

Custom delays can be configured per campaign.

### Retry Flow

```
┌─────────────────────────────────────────────────────┐
│                    Retry Flow                        │
├─────────────────────────────────────────────────────┤
│                                                      │
│   Make Call ──► Connected? ──► Yes ──► Mark Success  │
│       │                                              │
│       └──► No ──► Retryable? ──► No ──► Mark Failed  │
│                        │                             │
│                        └──► Yes ──► Attempts Left?   │
│                                          │           │
│                                    No ───┼──► Mark Failed
│                                          │           │
│                                    Yes ──┴──► Queue for Retry
│                                                 │    │
│                                                 ▼    │
│                                          Wait Delay  │
│                                                 │    │
│                                                 └────┘
│                                                      │
└─────────────────────────────────────────────────────┘
```

## Multi-Phone Distribution

Use multiple phone numbers to increase throughput and avoid rate limiting.

### Distribution Strategies

| Strategy | Description | Best For |
|----------|-------------|----------|
| **Round Robin** | Cycles through numbers evenly | Balanced load |
| **Least Used** | Picks number with fewest active calls | Maximize throughput |

### Round Robin

```
Numbers: [A, B, C]
Call 1 → A
Call 2 → B
Call 3 → C
Call 4 → A
Call 5 → B
...
```

### Least Used

```
Active calls: A=2, B=1, C=3
Next call → B (lowest active count)
```

### Per-Credential Rate Limiting

Each phone number has its own rate limit:

| Setting | Description | Default |
|---------|-------------|---------|
| **Rate Limit** | Calls per minute per number | 10 |
| **Max Parallel** | Simultaneous calls per number | 5 |

With 3 numbers:
- Total rate: 30 calls/minute
- Total parallel: 15 simultaneous calls

## Concurrency Control

### Settings

| Setting | Description | Recommendation |
|---------|-------------|----------------|
| **Max Parallel Calls** | Total simultaneous calls | 5-20 |
| **Rate Limit** | Total calls per minute | 30-120 |

### Campaign Size Guidelines

| Campaign Size | Max Parallel | Rate Limit | Est. Completion |
|---------------|--------------|------------|-----------------|
| Small (<100) | 5 | 30/min | ~3 min |
| Medium (<1000) | 10 | 60/min | ~17 min |
| Large (>1000) | 20 | 120/min | ~8 min per 1000 |

Note: Actual time depends on call duration, answer rates, and retries.

## Auto-Pause on Low Credits

Campaigns automatically pause when workspace credits run low:

### How It Works

1. System monitors credit balance during campaign
2. When balance falls below threshold, campaign pauses
3. Email notification sent to workspace owner
4. Campaign status: **PAUSED**
5. Pending calls preserved (not lost)

### After Adding Credits

1. Navigate to paused campaign
2. Click **Resume**
3. Calls continue from where they stopped

### Configuration

Credit threshold is workspace-level:
- Default: Pause when credits would go negative
- Custom thresholds available on request

## Stuck Call Recovery

Calls that exceed maximum duration are automatically failed:

| Setting | Value | Description |
|---------|-------|-------------|
| **Max Call Duration** | 5 minutes | Calls exceeding this are marked failed |
| **Recovery Check** | Every 30 seconds | System checks for stuck calls |

### Why Calls Get Stuck

- Network disconnection during call
- Server crash
- Telephony provider issues

### Recovery Behavior

1. System detects call running > 5 minutes
2. Call marked as **failed**
3. Added to retry queue (if retries remaining)
4. Logged with reason: "timeout"

## Best Practices

### Timing

1. **Business hours**: Call 9 AM - 6 PM local time
2. **Weekday preference**: Avoid weekends for B2B
3. **Regional timing**: Consider recipient timezones
4. **Avoid holidays**: Skip major holidays

### Retries

1. **3 attempts is sufficient**: More may annoy recipients
2. **Increasing delays**: Don't rapid-fire retries
3. **Business hours only**: Retry within calling window
4. **Skip voicemail**: Consider not retrying voicemail

### Concurrency

1. **Start low**: Begin with 5 parallel calls
2. **Monitor quality**: Check call completion rates
3. **Scale gradually**: Increase if system handles it
4. **Use multiple numbers**: Distribute load

### Multi-Number

1. **Similar numbers**: Use numbers from same region
2. **Rotate evenly**: Prevent single number exhaustion
3. **Monitor per-number**: Watch for blocked numbers
4. **Backup numbers**: Have extras ready

## Troubleshooting

### Campaign Won't Start

- Check credit balance
- Verify at least one phone number selected
- Ensure contacts uploaded
- Check time window (may be outside)

### Low Answer Rate

- Try different time windows
- Use local phone numbers
- Check if numbers are DND registered
- Review caller ID display

### Slow Progress

- Increase parallel calls
- Add more phone numbers
- Check rate limits
- Review retry settings

### Calls Failing Repeatedly

- Verify phone number format
- Check telephony provider status
- Review error messages in call logs
- Reduce concurrency if overloaded

## Next Steps

- [Creating a Campaign](https://edesy.in/docs/voice-agent/campaigns) - Full campaign setup guide
- [Campaign Analytics](https://edesy.in/docs/voice-agent/campaigns/analytics) - Monitor campaign progress
- [Phone Numbers Setup](https://edesy.in/docs/voice-agent/phone-numbers) - Configure calling credentials

---

**Ready to schedule a campaign?** [Open the Campaigns page](https://voice-agent.edesy.in/campaigns) to get started.
