Developer API

How to Integrate a Phone System into a Cloudflare Worker using the Click2Call API

A step-by-step guide for developers on connecting an Australian phone system to a Cloudflare Worker using the Click2Call API and webhooks.

By Royce Clark February 23, 2026

Key Takeaways

  • Serverless Voice: Connect a real Australian phone number directly to a Cloudflare Worker without managing any telecom infrastructure.
  • Real-Time Webhooks: Trigger Worker functions instantly on incoming calls, answered calls, or ended calls.
  • AI-Ready: Easily pass call data from your Worker to LLMs like Claude or ChatGPT for instant analysis.
  • Zero Maintenance: Click2Call handles the SIP trunks and carrier routing; you just write JavaScript.

Building modern business software often means integrating voice capabilities. Whether you're building a custom CRM, an automated support desk, or an AI voice agent, you need a reliable way to connect real phone calls to your code. Traditionally, this meant dealing with complex SIP trunks, PBX hardware, and telecom protocols.

Today, the landscape has changed. Using the Click2Call API and Cloudflare Workers, you can deploy a fully functional, serverless voice integration in an afternoon. This guide walks you through the process of connecting an Australian phone system to a Cloudflare Worker, allowing you to handle calls programmatically with zero infrastructure overhead.

Why Cloudflare Workers for Voice?

Cloudflare Workers are an ideal environment for handling voice API webhooks. They offer:

  • Ultra-low latency: Workers run on Cloudflare's global edge network, ensuring your webhook responses are lightning-fast—critical for voice applications where delays are noticeable.
  • Zero cold starts: Unlike traditional serverless functions, Workers don't suffer from cold starts, meaning the first ring is handled just as quickly as the hundredth.
  • Cost-effective scaling: You only pay for what you use, making it perfect for unpredictable call volumes.

Step 1: Setting Up Your Click2Call Webhook

The first step is telling Click2Call where to send data when a call event occurs. In your Click2Call portal, navigate to the API > Webhooks section.

Create a new webhook and configure it to point to your Cloudflare Worker URL (e.g., https://voice-handler.yourdomain.workers.dev). You can select which events should trigger the webhook:

  • Incoming Calls: Ringing, Answered, Ended, Missed
  • Outgoing Calls: Ringing, Answered, Ended, Unattended
  • AI Analysis: Recording and AI transcription generation

For a basic integration, selecting "Ringing Event" and "Ended Event" is a great starting point.

Content-Type: application/json
Authorization: your-secret-token
Content:
{
  "event": "ringing",
  "call_id": "123456789",
  "caller_id": "+61400000000",
  "called_number": "+61280000000",
  "timestamp": "2026-04-16T10:00:00Z"
}

Step 2: Writing the Cloudflare Worker

Now, let's write the Worker code to handle these incoming webhooks. We'll create a simple script that logs the call details and can be easily extended to trigger other actions, like sending a Slack notification or querying a database.

export default {
  async fetch(request, env, ctx) {
    // Only accept POST requests
    if (request.method !== 'POST') {
      return new Response('Method Not Allowed', { status: 405 });
    }

    // Verify the authorization token
    const authHeader = request.headers.get('Authorization');
    if (authHeader !== env.CLICK2CALL_SECRET) {
      return new Response('Unauthorized', { status: 401 });
    }

    try {
      const payload = await request.json();
      
      // Handle different event types
      switch (payload.event) {
        case 'ringing':
          console.log(`Incoming call from ${payload.caller_id}`);
          // Add your custom logic here (e.g., CRM lookup)
          break;
        case 'ended':
          console.log(`Call ${payload.call_id} ended`);
          break;
        case 'transcription_ready':
          console.log(`Transcription available for ${payload.call_id}`);
          // Send transcription to an LLM for summarization
          break;
      }

      return new Response('Webhook received', { status: 200 });
    } catch (error) {
      console.error('Error processing webhook:', error);
      return new Response('Bad Request', { status: 400 });
    }
  }
};

Step 3: Extending with the Click2Call API

Webhooks are great for receiving data, but what if you want to take action? The Click2Call API allows your Worker to actively manage calls and account settings.

For example, when a call ends, your Worker could use the API to fetch the call recording or transcription, then pass that data to Claude or ChatGPT to generate a summary and push it to your CRM.

"By combining Click2Call's robust API with the serverless power of Cloudflare Workers, developers can build enterprise-grade voice applications without touching a single piece of telecom hardware."

Ready to Build?

Integrating a real Australian phone system into your custom software has never been easier. With Click2Call's developer-friendly API and comprehensive webhook support, you can focus on writing code, not managing infrastructure.

Every Click2Call account includes full API access. Explore the Developer API to see what else you can build.

Frequently Asked Questions

Royce Clark

Written by

Royce Clark

Royce is a technical writer and developer advocate specializing in cloud communications and AI integrations.