Skip to main content

Sessions vs Calls

In Kallglot, Sessions and Calls represent different layers of abstraction. Understanding this distinction helps you build more flexible integrations.

What is a Session?

A Session is Kallglot’s core unit of work. It represents a real-time voice processing connection that handles:
  • Audio streaming
  • Speech-to-text transcription
  • Real-time translation
  • Text-to-speech synthesis
  • Recording
  • AI processing
Sessions are provider-agnostic. The same session can process audio from:
  • A Twilio phone call
  • A Telnyx phone call
  • A WebRTC browser connection
  • A SIP endpoint
  • Direct audio streaming via WebSocket

What is a Call?

A Call is a telephony connection managed by a provider (Twilio, Telnyx, or SIP). Calls handle:
  • Phone number dialing
  • PSTN connectivity
  • Call routing
  • Telephony features (hold, transfer, etc.)
A single session can involve multiple calls:
  • Incoming call from a customer
  • Outgoing call to an agent
  • Conference call with multiple participants

Session-Centric Design

Kallglot uses a session-centric API design:
  1. Create a Session - This sets up the processing pipeline
  2. Connect Audio - Attach one or more audio sources (calls, WebRTC, etc.)
  3. Process in Real-time - Transcription, translation, AI
  4. End Session - Finalize recording and transcripts

Example: Inbound Call

// 1. Webhook receives incoming call from Twilio
app.post('/twilio/incoming', async (req, res) => {
  const { CallSid, From, To } = req.body;

  // 2. Create a Kallglot session
  const session = await createKallglotSession({
    mode: 'bidirectional_translation',
    source_language: 'de',
    target_language: 'en',
    provider: {
      type: 'twilio',
      call_sid: CallSid
    }
  });

  // 3. Connect the call to Kallglot's media stream
  const response = new twiml.VoiceResponse();
  response.connect().stream({
    url: session.stream.url,
    parameters: { token: session.stream.token }
  });

  res.type('text/xml').send(response.toString());
});

Example: WebRTC Session

// 1. Create session for browser-based voice
const session = await createKallglotSession({
  mode: 'ai_agent',
  source_language: 'en',
  target_language: 'en'
  // No provider specified - using WebSocket directly
});

// 2. Connect from browser
const ws = new WebSocket(`${session.stream.url}?token=${session.stream.token}`);

// 3. Stream microphone audio
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
// ... stream audio to WebSocket

Billing Model

Billing is based on session duration, not call duration:
What’s BilledDescription
Active session timeTime from first audio received to session end
Translation minutesMinutes where translation was active
AI agent minutesMinutes where AI agent was processing
This means:
  • A 5-minute call with a 5-minute session = 5 minutes billed
  • A 5-minute call with a 10-minute session (including hold) = 10 minutes billed
  • Two 3-minute calls in one session = 6 minutes billed total

Session Lifecycle

Status Descriptions

StatusDescription
createdSession created, waiting for audio connection
connectingAudio source connecting
activeProcessing audio in real-time
endingFinalizing recording and transcript
endedSession complete, resources available

Multiple Participants

A single session can handle multiple audio sources:
// Conference session with multiple participants
const session = await createKallglotSession({
  mode: 'bidirectional_translation',
  source_language: 'de',
  target_language: 'en',
  participants: [
    { type: 'agent', language: 'en' },
    { type: 'customer', language: 'de' }
  ]
});

// Both participants connect to the same session
// Agent connects via WebRTC
// Customer connects via phone call

Best Practices

Create the session before the call connects. This ensures the processing pipeline is ready when audio starts flowing.
End sessions as soon as the conversation is complete. This stops billing and triggers recording/transcript finalization.
Attach custom metadata to sessions for easy correlation with your internal systems:
{
  "metadata": {
    "customer_id": "cust_123",
    "ticket_id": "ticket_456",
    "agent_id": "agent_789"
  }
}
If a call disconnects but may reconnect, keep the session active. You can reconnect new audio to the same session within 5 minutes.