Skip to content

Scenarios and Recipes

Andrey Egorov edited this page May 18, 2026 · 7 revisions

Demo Walkthrough

If you want importable workflows that build up to the canonical demo, start here instead of treating this page as a tutorial:

1. Inbound IVR on a Trunk

Goal

Answer a carrier call, play a prompt, collect DTMF, and route the caller.

Typical node chain

  1. SIP PBX Trigger -> Trunk Event
  2. SIP PBX -> Call -> Answer
  3. SIP PBX -> Media -> Play Audio
  4. SIP PBX -> Call -> Wait For Event

Recommended Wait For Event setup

Rules:

  • 1 -> Sales
  • 2 -> Support
  • 0 -> Operator

Also consider:

  • enable DTMF Fallback if you want a catch-all branch
  • set Interdigit Timeout explicitly for multi-digit menus

Why this pattern works well

  • the trigger provides a stable legId
  • playback can be blocking for deterministic IVR flow
  • DTMF branches map directly to business paths

2. Ring a Group of Internal Extensions

Goal

Dial one or more registered extensions without manually naming a specific extensions trigger ref.

Typical node chain

  1. trunk or extension call arrives
  2. SIP PBX -> Dial -> Make Call
  3. Mode = Extension
  4. Extensions = 100,101,102
  5. SIP PBX -> Dial -> Wait For Event
  6. SIP PBX -> Call -> Bridge once answered

Why extension mode is useful

  • it searches all matching extensions refs within the current workflow
  • it can fan out to multiple endpoints of the same extension number
  • by default it ignores busy endpoints

When to disable Only Free Endpoints

Disable it only if you intentionally want to target busy registered endpoints as well.

3. Sequential Extension Hunt Order

Goal

Try extension 200 first, then 100, while exhausting all 200 endpoints before moving on.

Setup

Make Call:

  • Mode = Extension
  • Extensions = 200,100
  • Call Strategy = Sequential

Optional tuning:

  • Sequential Attempt Timeout (Seconds)
  • Sequential Gap (Seconds)

Behavior

The runtime preserves the extension number order you entered and exhausts all matching endpoints of one number before moving to the next.

4. Queue With Hold Music and Callback Preservation

Goal

Place a caller in queue, keep them there while waiting, and preserve queue position if they hang up and call back later.

Typical flow

Caller path:

  1. inbound trigger
  2. Answer
  3. optional announcement
  4. Queue -> Put Leg In Queue
  5. Media -> Play Audio in Background mode for hold music

Queue event path:

  1. SIP PBX Trigger -> Queue Event
  2. branch on Placed, Dispatch, Offline

Callback support:

  1. Queue -> Set Callback
  2. Callback Enabled = true

Important behavior:

  • enabling callback does not remove the caller from the live queue immediately
  • it only changes what queue does later if the caller hangs up before service

Important options

Put Leg In Queue:

  • Rejoin Existing = true
  • Retry Attempts
  • Retry Cooldown

Queue Event:

  • operator extension numbers

Expected result

  • the daemon, not the workflow, owns operator redial and pacing
  • a returning caller can rejoin the preserved queue entry instead of starting from scratch

5. Workflow-Controlled Call Recording

Goal

Decide per call whether automatic call recording should start and where the file should go.

Typical flow

  1. Trunk Event or Extension Event
  2. enable Global Call Recording
  3. use the Recording trigger branch
  4. route through business logic
  5. SIP PBX -> Global recording -> Respond to recording

Useful decisions

  • record only certain queues or callers
  • split channels for later analysis
  • wait for completion when downstream logic needs final size or duration

6. Workflow-Assisted Extension Authentication

Goal

Use n8n to participate in extension auth decisions.

Typical flow

  1. SIP PBX Trigger -> Extension Event
  2. set Auth Mode = Digest First or Raw
  3. on Auth branch inspect:
    • requestType
    • auth.username
    • auth.realm
    • remoteIp
  4. respond with Respond To Auth

Common strategies

  • Allow trusted users immediately
  • Verify Digest Password from a workflow-managed secret source
  • Challenge or Deny based on policy
  • Not Applicable when this workflow is not the final decision-maker

7. Caller to AI Voice Agent Bridge

Goal

Bridge a live caller to an AI voice agent running on a WebSocket leg.

Typical flow

  1. inbound caller arrives
  2. SIP PBX -> Dial -> Make Call
  3. Mode = WebSocket
  4. choose OpenAI Realtime or Gemini Live
  5. optionally set WebSocket Start Mode = Deferred
  6. SIP PBX -> AI -> Attach Voice Agent
  7. SIP PBX -> Call -> Bridge

Optional additions

  • connect an ai_memory input
  • connect one or more Invoke AI Tool nodes as ai_tool inputs

Why Deferred often helps

It lets the workflow load memory and tool definitions before the provider session starts.

8. AI Tool Invocation Inside a Voice Session

Goal

Let the model call workflow tools during a live voice interaction.

Typical flow

  1. create WebSocket AI leg
  2. attach voice agent with connected ai_tool nodes
  3. tool call lands on AI Tool Call
  4. inspect flowParams and toolParams
  5. run business logic
  6. Respond To AI Tool

Good use cases

  • CRM lookup
  • order status
  • appointment scheduling
  • internal routing decisions

9. Long Recording With Explicit Stop

Goal

Start recording immediately but stop it later based on a different event.

Typical flow

  1. Record Audio
  2. set Execution Mode = Background
  3. save mediaId
  4. later:
    • Stop Media by mediaId
    • or Wait Media

Why background mode matters

The workflow does not block while the daemon keeps the recording alive.

Clone this wiki locally