Developer platform

Build programmable voice workflows in the language you already use

Create and modify calls, generate safe Voice XML, record audio, collect caller input, and stream media to AI services with official PHP, Python, and Node.js SDKs.

Use a NextGenSwitch deployment and API credentials. Keep all credentials outside source control.

const flow = new VoiceResponse()
  .say("Welcome to NextGenSwitch.")
  .gather(
    { action: webhookUrl, numDigits: 1 },
    (gather) => gather.say("Press one for sales.")
  );

await client.createCall({
  to: "2001",
  from: "1001",
  responseXml: flow,
});

Official SDKs

Choose your stack

Each SDK follows the same API model and includes runnable examples for creating, modifying, recording, and streaming calls.

PHP

PHP 8.1+

Composer-ready package with typed call results, Voice XML builders, and webhook models.

composer require nextgenswitch/nextgenswitch-php
View SDK on GitHub

Python

Python 3.9+

Sync and async clients, escaped Voice XML, callback parsing, and typed errors.

pip install "nextgenswitch @ git+https://github.com/nextgenswitch/nextgenswitch-python.git"
View SDK on GitHub

Node.js

Node.js 18+

TypeScript-first SDK with ESM, CommonJS, declarations, call control, and webhook helpers.

npm install github:nextgenswitch/nextgenswitch-nodejs
View SDK on GitHub
The Python and Node.js commands above install directly from GitHub until their first public registry releases. Check each repository README for the current installation channel.

10-minute quickstart

Make your first API-controlled call

Use this sequence with any official SDK. The repository examples contain language-specific, runnable versions.

  1. Prepare a non-production deployment.Obtain the base URL, authorization code, and authorization secret from your NextGenSwitch environment.
  2. Install one SDK.Select PHP, Python, or Node.js above and follow its README.
  3. Set environment variables.Use NEXTGENSWITCH_BASE_URL, NEXTGENSWITCH_AUTHORIZATION, and NEXTGENSWITCH_AUTHORIZATION_SECRET.
  4. Build a Voice XML response.Start with Say, then add Gather, Dial, Record, or Stream as required.
  5. Create the call and observe callbacks.Use test destinations, TLS webhook URLs, strict input validation, and logs that do not expose credentials.

Common workflows

From a first call to an AI voice application

Create and modify calls

Start an outbound call, replace the active call flow, redirect, bridge, or end it.

Record and collect input

Capture recordings or use Gather for DTMF and speech-driven workflows.

Stream audio to AI

Send bidirectional call audio to a WebSocket service that securely resolves AI-provider credentials.

Process webhooks

Parse Gather and Dial callbacks and return the next validated Voice XML response.

Developer FAQ

Common SDK and Voice API questions

Do I need a NextGenSwitch deployment to use the SDKs?

Yes. Each SDK connects to the Programmable Voice API on a NextGenSwitch deployment and requires its base URL, authorization code, and authorization secret.

Which NextGenSwitch SDK should I choose?

Choose the SDK that matches your application stack: PHP 8.1 or newer, Python 3.9 or newer, or Node.js 18 or newer. The SDKs follow the same call-control and Voice XML model.

Are the Python and Node.js SDKs available on public registries?

Their repositories are the current source of truth. Until the first PyPI and npm releases, use the GitHub installation commands shown on this page and in each repository README.

Can the SDKs modify or record an active call?

Yes. The SDKs include helpers for replacing an active call flow and building Record instructions. Recording notice, consent, storage, retention, and access requirements remain the deployer’s responsibility.

Can I connect a NextGenSwitch call to an AI voice service?

Yes. The Stream helper can connect bidirectional call audio to a WebSocket service. Keep AI-provider credentials on that service rather than placing secrets in Voice XML.

How should API credentials and webhooks be secured?

Keep credentials in environment variables or a secret manager, require HTTPS, redact authorization headers from logs, validate callback fields, and apply deployment-appropriate network and authentication controls.

Ready to design a production call flow?

Review the API behavior, test failure paths, and talk with the team about deployment, capacity, SIP connectivity, and security responsibilities.