Skip to main content

Lead Lifecycle

scheduler.py only selects leads where:
When a SIP call is successfully triggered, the lead is marked dispatched.

Call Lifecycle

Each dial attempt gets its own calls row. This means one lead can have multiple call attempts over time.

Successful Call Flow

  1. Lead starts as new.
  2. Scheduler validates call window and phone number.
  3. Scheduler creates a calls row with status='calling'.
  4. Scheduler calls LiveKit create_sip_participant.
  5. LiveKit uses the configured outbound SIP trunk to call the lead through Vobiz.
  6. Agent joins ignitech-lead-{lead_id}.
  7. Lead answers and speaks with the agent.
  8. Agent extracts structured qualification.
  9. db.save_qualification() stores JSON and marks the call called.
  10. talkingshops_pusher.py pushes the record to Talking Shops.
  11. db.set_call_pushed() marks the call pushed.

Failure Reasons

The calls.failure_reason field is machine-readable.

Retry Behavior

Retry scheduling is centralized in db.py. Default:
When retryable failure occurs, the lead is set back to:
If retry_count exceeds MAX_CALL_RETRIES, the lead is marked failed.

Phone Validation

Outbound dialing is India-mobile focused. The scheduler accepts:
  • 98765XXXXX
  • 098765XXXXX
  • 9198765XXXXX
  • +9198765XXXXX
It rejects values that cannot safely become:
The local 10-digit mobile number must start with 6, 7, 8, or 9.

Whitelist Mode

For testing, you can restrict dialing to selected numbers:
When this is set, any lead outside the whitelist is marked failed instead of called.