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 Developer platform
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
Each SDK follows the same API model and includes runnable examples for creating, modifying, recording, and streaming calls.
Composer-ready package with typed call results, Voice XML builders, and webhook models.
composer require nextgenswitch/nextgenswitch-php
View SDK on GitHub 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 TypeScript-first SDK with ESM, CommonJS, declarations, call control, and webhook helpers.
npm install github:nextgenswitch/nextgenswitch-nodejs
View SDK on GitHub 10-minute quickstart
Use this sequence with any official SDK. The repository examples contain language-specific, runnable versions.
NEXTGENSWITCH_BASE_URL, NEXTGENSWITCH_AUTHORIZATION, and NEXTGENSWITCH_AUTHORIZATION_SECRET.Say, then add Gather, Dial, Record, or Stream as required.Common workflows
Start an outbound call, replace the active call flow, redirect, bridge, or end it.
Capture recordings or use Gather for DTMF and speech-driven workflows.
Send bidirectional call audio to a WebSocket service that securely resolves AI-provider credentials.
Parse Gather and Dial callbacks and return the next validated Voice XML response.
Developer FAQ
Yes. Each SDK connects to the Programmable Voice API on a NextGenSwitch deployment and requires its base URL, authorization code, and authorization secret.
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.
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.
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.
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.
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.
Review the API behavior, test failure paths, and talk with the team about deployment, capacity, SIP connectivity, and security responsibilities.