Voice AI

Build AI Assistant Multiparticipant Calling with Telnyx Voice AI

Most voice AI demos are one-to-one: a caller talks to an AI assistant, the AI answers, and the call ends. Real support, healthcare, financial services, and sales workflows are often more collaborative. The AI may need to bring in an engineer, account specialist, care team member, licensed advisor, or sales rep without making the caller hang up and start over.

The Telnyx code example is here:

https://github.com/team-telnyx/telnyx-code-examples/tree/main/ai-assistant-multiparticipant-calling-nodejs

It is a Node.js + Express example that shows the backend-driven pattern for adding another participant to an active Telnyx AI Assistant conversation.

What This Example Builds

The example starts with a normal inbound call to a Telnyx number. The Express app receives the Voice webhook and answers with an inline AI Assistant configuration. The assistant is instructed to triage the caller, ask for consent before adding another person, and then call a backend tool named dial_specialist.

When that tool is called, the backend:

  • Uses POST /v2/calls to dial the specialist
  • Stores the specialist call control ID
  • Waits for Telnyx to send call.answered for that second call leg
  • Calls ai_assistant_join with the current AI conversation_id

That final API call is the key step. It joins the answered specialist leg into the existing AI Assistant conversation.

Architecture

caller dials Telnyx number
  -> Telnyx sends call.initiated
  -> Express app answers with AI Assistant
  -> AI classifies issue and asks for consent
  -> AI calls dial_specialist tool
  -> backend dials specialist with POST /v2/calls
  -> Telnyx sends call.answered for specialist leg
  -> backend calls ai_assistant_join
  -> caller + AI + specialist share one live conversation

Why This Pattern Matters

The important user experience detail is continuity. The caller is not transferred away from the AI call. The caller does not need to repeat the whole issue. The AI can summarize the context when the specialist joins, then stay available for coordination or follow-up.

This is useful for workflows like:

  • Developer support: AI triages the issue, then brings in an engineer or integrations specialist
  • Healthcare operations: AI verifies identity and routes to a care team member when a human is needed
  • Financial services: AI collects context and then adds a licensed advisor
  • Sales: AI qualifies the lead and brings in the right account executive

The backend pattern stays the same: the AI handles the front door, a tool call tells your backend to dial the next participant, and Telnyx joins that participant into the same AI conversation.

Run The Example

git clone https://github.com/team-telnyx/telnyx-code-examples.git
cd telnyx-code-examples/ai-assistant-multiparticipant-calling-nodejs
cp .env.example .env
npm install
npm test
npm start

Fill in:

TELNYX_API_KEY=KEY...
CONNECTION_ID=your_voice_api_application_connection_id
TELNYX_NUMBER=+13125550001
SPECIALIST_NUMBER=+13125550002
PUBLIC_URL=https://your-ngrok-url.ngrok-free.app
PORT=8787

Expose the app:

ngrok http 8787

Set your Programmable Voice / Voice API application webhook URL to:

https://<your-ngrok-domain>/webhooks/voice

Then call the Telnyx number.

The Core Code

The assistant tool calls the backend:

app.post("/tools/dial-specialist", async (_req, res) => {
  res.json({ status: "dialing_specialist", async: true });
  // backend dials SPECIALIST_NUMBER with POST /v2/calls
});

When the specialist answers, the backend joins that call leg:

await fetch(`https://api.telnyx.com/v2/calls/${id}/actions/ai_assistant_join`, {
  method: "POST",
  headers: telnyxHeaders(),
  body: JSON.stringify({
    conversation_id: session.conversationId,
    participant: {
      id: specialistCallControlId,
      role: "user",
      name: "support specialist",
      on_hangup: "continue_conversation",
    },
  }),
});

The conversation_id is captured from AI webhook events. The specialistCallControlId comes from the outbound call created by POST /v2/calls.

Production Considerations

Before using this pattern in production:

  • Verify Telnyx webhook signatures before trusting inbound events
  • Store sessions in Redis or a database instead of memory
  • Add retries and failure handling around outbound dialing
  • Add assistant instructions or a Skip Turn tool so the AI does not interrupt human-to-human discussion
  • Log consent before dialing another participant
  • Consider role-specific display names and audit logs for regulated workflows

Resources

  • Code example: https://github.com/team-telnyx/telnyx-code-examples/tree/main/ai-assistant-multiparticipant-calling-nodejs
  • Multi-participant calls docs: https://developers.telnyx.com/docs/inference/ai-assistants/multi-participant-calls
  • Join AI Assistant Conversation API: https://developers.telnyx.com/api-reference/call-commands/join-ai-assistant-conversation
  • Telnyx Developer Docs: https://developers.telnyx.com
  • Telnyx Portal: https://portal.telnyx.com

Ready to build with low-latency voice AI?

Join developers building the future of real-time conversations