Build an AI Phone Receptionist with n8n, Your Own SIP Trunk and Your Own AI Keys

A phone that rings out, or a voicemail nobody plays back until Monday, costs you the customer who called. This guide builds an AI receptionist that answers your business number, takes a proper message and offers a callback, then drops every call's summary into your n8n workflow, where it becomes a Slack message, a spreadsheet row or a CRM entry.
You keep the three pieces that matter: your own phone number on your own SIP trunk, your own AI provider keys (or MediaSFU-managed AI if you'd rather not), and your own self-hosted n8n. MediaSFU sits in the middle: it answers the call, runs the voice agent and writes the summary.
What you'll build
- Someone calls your number. Your SIP provider passes the call to MediaSFU.
- The AI receptionist attached to that number answers, using your AI provider key.
- When the caller hangs up, MediaSFU writes a summary and sends it to your n8n workflow.
- n8n tells the front desk on Slack when a callback is needed, and logs every call in Google Sheets.
No code runs on your side apart from n8n. Allow about 30 minutes.
Before you start
- A MediaSFU account and an API key from mediasfu.com/api-keys. A sandbox key is fine while you build.
- A phone number on a SIP trunk. This guide uses a Twilio Elastic SIP Trunk; the docs also cover VoIP.ms, and Telnyx, Plivo and other providers work the same way.
- An AI provider key for the voice agent, for example a Gemini Live or OpenAI Realtime key. Or skip it and use MediaSFU-managed AI.
- A self-hosted n8n that the internet can reach over HTTPS without a custom port. For now the MediaSFU node installs on self-hosted n8n.
Step 1: Connect your SIP trunk
Your trunk needs to trust MediaSFU, and MediaSFU needs to know your number. In the Twilio Console, open your Elastic SIP Trunk:
- IP Access Control List (Termination): add both MediaSFU SIP signalling addresses as /32 entries. MediaSFU signals from two regions, so keep both. The current addresses are on the Telephony guide.
- Origination SIP URI (incoming calls): your number at
sip01.mediasfu.com, for examplesip:+15551234567@sip01.mediasfu.com. - Associate your number with the trunk.
Then, in the MediaSFU dashboard, open Phone & SIP Setup and choose Add a number:
- Enter the number in E.164 format (
+15551234567), choose Twilio and the direction Both. - On Peer Config, paste the host from the trunk's Termination SIP URI (for example
your-trunk.pstn.twilio.com, withoutsip:or a port). Use port 5060 for UDP or TCP, or 5061 for TLS, and leave Register with Provider off. - Choose Create SIP Config.
Prefer to script it? The same line can be created over HTTP from your server:
curl -X POST https://mediasfu.com/v1/sipconfigs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MEDIASFU_API_USERNAME:$MEDIASFU_API_KEY" \
-d '{"action":"create","contactNumber":"+15551234567","provider":"twilio","supportSipActive":true,"supportSipNameCalls":true,"allowOutgoing":true}'
The full walkthrough, with fixes for calls that don't connect, is in Connect a Twilio SIP trunk.
Step 2: Add your AI keys
The receptionist listens, thinks and speaks with the AI provider you choose. In the dashboard, open AI Provider Keys and add your key under a nickname. A realtime speech provider such as Gemini Live or OpenAI Realtime gives the most natural conversation.
From your server, the same thing is one request:
curl -X POST https://mediasfu.com/v1/aicredentials \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MEDIASFU_API_USERNAME:$MEDIASFU_API_KEY" \
-d '{"action":"create","nickName":"front-desk-voice","type":"VOICE","extra":[{"key":"service","value":"Gemini-Live"}],"apiKey":"your-provider-key"}'
The supported providers include OpenAI, Anthropic Claude, Gemini, Deepgram, AssemblyAI, Whisper, ElevenLabs, Cartesia, OpenAI Realtime and Gemini Live; the dashboard's wizard lists more voices and options. MediaSFU shows the key masked from then on. To use MediaSFU-managed AI instead, skip this step.
Step 3: Create the receptionist
Open the Agents Workspace and pick the AI Receptionist template. Fill in your company name and the agent's name. The template's instructions are a good start:
You are {agentName}, the friendly AI receptionist for {companyName}. Greet people warmly, find out why they are reaching out, and either answer their question, take a detailed message, or offer a callback. Always collect the person's name and best contact number or email before wrapping up. If a request is urgent or clearly needs a person, offer to connect them with the team. Never invent details you are not sure about — take a message instead.
It greets callers first: "Hi! Thanks for reaching {companyName}. I'm {agentName}, the virtual receptionist. How can I help you today?" Add your opening hours, services and anything callers often ask, choose the AI key from Step 2, and attach the agent to your number.
Call your number now. The receptionist should answer. Ask a question, leave your name, and hang up.
Step 4: Install the MediaSFU node in n8n
In n8n, open Settings → Community Nodes → Install, enter n8n-nodes-mediasfu and accept the prompt. (From the command line instead: npm install n8n-nodes-mediasfu in your n8n custom-nodes folder, then restart n8n.) Search the node panel for MediaSFU: you should see MediaSFU (actions) and MediaSFU Trigger.
Add a MediaSFU API credential with your API username and API key. n8n tests it by reading your balance. The key stays in n8n's credential store and is sent only to MediaSFU.
Step 5: Send every call to your workflow
Create a workflow and add these nodes:
- MediaSFU Trigger with the event Phone Call Summary Ready. Copy its production URL.
- IF, with the condition:
{{ ($json.summary || '').toLowerCase() }}containscall back, OR the same expression containscallback. - On the true branch, Slack: post to your front-desk channel.
- On both branches, Google Sheets: append a row to your call log.
Now point your number at the trigger. In Phone & SIP Setup, open your number and set its webhook URL to the trigger's production URL. Give the number a secure code if it has none, and enter the same code in the trigger's Call Webhook Token. The trigger refuses any request without that code, so nobody else can post fake calls into your workflow.
Each call arrives as a flat item, ready for expressions:
| Field | What it holds |
|---|---|
caller | The caller's number |
calledNumber | Your number they called |
durationSeconds | Call length |
agentAnswered | Whether the receptionist took the call |
summary | The AI summary of the conversation |
transcript | The conversation, message by message |
sipCallId | The call's ID, for the MediaSFU node's call operations |
A Slack message that the front desk can act on:
📞 Callback needed: {{ $json.caller }} called {{ $json.calledNumber }} ({{ $json.durationSeconds }} s)
{{ $json.summary }}
For the sheet, map columns such as Time ({{ $now }}), Caller, Number called, Duration, Summary and Call ID.
Step 6: Get a person on urgent calls
The receptionist offers to connect a caller with your team when something is urgent. Catch that moment with a second workflow: MediaSFU Trigger on Human Handoff Requested (same webhook URL and token), then Slack with {{ $json.priority }}, {{ $json.handoffReason }} and {{ $json.caller }}.
When a teammate is ready in the call's room, the MediaSFU node's Agent Call → Hand to Person operation, with the sipCallId, switches the live call from the agent to them. AI call control covers handing calls back and forth.
Test it
- Activate both workflows. The trigger listens on its production URL only while the workflow is active.
- Call your number, ask to be called back tomorrow, and hang up.
- Within a few seconds of the summary, a Slack message and a new sheet row appear.
If nothing arrives:
| Symptom | Fix |
|---|---|
| The call rings but nobody answers | Attach the agent to the number in the Agents Workspace, and check the number's SIP config is active |
| The trigger never fires | n8n must be on public HTTPS without a custom port, and the workflow must be active, not just under test |
| Phone call events return 401 | The number's secure code and the trigger's Call Webhook Token must match |
| No summary arrives | Summaries need an AI provider: add your key under AI Provider Keys, or use MediaSFU-managed AI |
After hours
Use a second agent for evenings and weekends: the After-hours line template tells callers when the team is next available, takes a clear message and marks anything urgent. Attach it to the number when the office closes, or switch agents on a schedule from your automation.
Good to know
- Calls are recorded only if you turn on Auto Record for the number.
- When a caller books a callback, the Callback Requested event passes the request on but never the caller's PIN.
- The MediaSFU node also works as a tool for n8n's AI Agent node, and can create rooms, start outbound agent calls and read recordings.
- A sandbox key keeps everything in sandbox while you build; switch the credential to a production key when you go live.
Next steps
- Automate MediaSFU with n8n: every action and trigger event.
- The AI receptionist starter: a small dashboard of recent calls, with prompts for business hours and after hours.
- n8n-nodes-mediasfu on GitHub: the node's source, MIT licensed.
- Building this for clients? See MediaSFU for agencies.
Get your API key at mediasfu.com and let the receptionist take your next call.