Skip to main content

Telephony Providers

Kallglot integrates with multiple telephony providers to connect phone calls to your voice sessions. Each provider handles the PSTN connectivity while Kallglot processes the audio.

Supported Providers

ProviderTypeUse Case
TwilioCloudMost common, easy setup
TelnyxCloudCost-effective, global coverage
SIPProtocolEnterprise PBX integration

Twilio

Twilio is the most popular cloud telephony provider and offers easy integration with Kallglot.

Setup

  1. Create a Twilio account at twilio.com
  2. Purchase a phone number
  3. Configure the webhook URL to point to your application
  4. Your app creates Kallglot sessions and returns TwiML

Inbound Call Flow

Example: Inbound Call Webhook

app.post('/webhooks/twilio/voice', async (req, res) => {
  const { CallSid, From, To } = req.body;

  // Create Kallglot session
  const session = await createKallglotSession({
    mode: 'bidirectional_translation',
    source_language: 'de',
    target_language: 'en',
    provider: {
      type: 'twilio',
      call_sid: CallSid
    },
    metadata: {
      from: From,
      to: To
    }
  });

  // Return TwiML to connect the call to Kallglot
  const response = new VoiceResponse();
  const connect = response.connect();
  connect.stream({
    url: session.stream.url,
    parameters: {
      token: session.stream.token
    }
  });

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

Outbound Calls

// Create session first
const session = await createKallglotSession({
  mode: 'bidirectional_translation',
  source_language: 'en',
  target_language: 'de',
  provider: {
    type: 'twilio',
    phone_number: '+14155551234'
  }
});

// Initiate outbound call via Twilio
const call = await twilioClient.calls.create({
  url: `https://your-app.com/webhooks/twilio/outbound?session_id=${session.id}`,
  to: '+4915123456789',
  from: '+14155551234'
});

Telnyx

Telnyx offers competitive pricing and excellent global coverage.

Setup

  1. Create a Telnyx account at telnyx.com
  2. Create a TeXML application
  3. Purchase a phone number and assign it to the application
  4. Configure the webhook URL

Example: Inbound Call Webhook

app.post('/webhooks/telnyx/voice', async (req, res) => {
  const event = req.body.data;
  const { call_control_id, from, to } = event.payload;

  // Create Kallglot session
  const session = await createKallglotSession({
    mode: 'bidirectional_translation',
    source_language: 'de',
    target_language: 'en',
    provider: {
      type: 'telnyx',
      call_control_id: call_control_id
    }
  });

  // Return TeXML to connect the call
  const texml = `
    <?xml version="1.0" encoding="UTF-8"?>
    <Response>
      <Connect>
        <Stream url="${session.stream.url}">
          <Parameter name="token" value="${session.stream.token}"/>
        </Stream>
      </Connect>
    </Response>
  `;

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

Telnyx vs Twilio

FeatureTwilioTelnyx
PricingHigherLower
Global coverageExcellentExcellent
DocumentationExtensiveGood
Media streamsYesYes
Number portingYesYes

SIP

For enterprise customers with existing PBX systems, Kallglot supports direct SIP integration.

Setup

  1. Configure your PBX to route calls to Kallglot’s SIP endpoint
  2. Set up SIP credentials in your Kallglot organization settings
  3. Configure your PBX to handle the media stream

SIP Endpoint

sip:session_{session_id}@sip.kallglot.com

Example: Creating a SIP Session

const session = await createKallglotSession({
  mode: 'bidirectional_translation',
  source_language: 'de',
  target_language: 'en',
  provider: {
    type: 'sip',
    sip_uri: 'sip:agent@your-pbx.com',
    credentials: {
      username: 'kallglot',
      password: 'your-sip-password'
    }
  }
});

// The SIP URI to dial into this session:
console.log(`SIP URI: sip:${session.id}@sip.kallglot.com`);

SIP Configuration Options

OptionDescription
sip_uriYour PBX endpoint to connect
credentialsSIP authentication credentials
transportudp, tcp, or tls (default: tls)
codecsPreferred audio codecs

WebRTC (No Provider)

For browser-based applications, you can stream audio directly via WebSocket without any telephony provider.
// Create session without provider
const session = await createKallglotSession({
  mode: 'ai_agent',
  source_language: 'en',
  target_language: 'en'
  // No provider specified
});

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

// Stream microphone audio
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
// ... process and send audio

Provider Events

Kallglot sends webhook events for provider-related status changes:
{
  "type": "session.provider.connected",
  "session_id": "sess_01HXYZ",
  "provider": {
    "type": "twilio",
    "call_sid": "CA123",
    "status": "connected"
  }
}

Event Types

EventDescription
session.provider.connectingCall is being established
session.provider.connectedCall connected successfully
session.provider.disconnectedCall ended
session.provider.failedCall failed to connect

Best Practices

Always use TLS transport for SIP connections to ensure audio is encrypted in transit.
Implement fallback logic if a provider connection fails. Consider having a secondary provider configured.
Use provider dashboards to monitor call quality metrics (jitter, packet loss) alongside Kallglot analytics.
Always test your integration with real phone calls, not just WebSocket connections. PSTN calls have different characteristics.