{"skill":{"slug":"phone-voice","displayName":"Phone Voice Integration","summary":"Connect ElevenLabs Agents to your OpenClaw via phone with Twilio. Includes caller ID auth, voice PIN security, call screening, memory injection, and cost tracking.","description":"---\nname: phone-voice\ndescription: Connect ElevenLabs Agents to your OpenClaw via phone with Twilio. Includes caller ID auth, voice PIN security, call screening, memory injection, and cost tracking.\nversion: 2.0.0\nauthor: Fred (@FredMolty)\n---\n\n# Phone Voice Integration\n\nTurn your OpenClaw into a phone-callable assistant with ElevenLabs Agents + Twilio.\n\n**What you get:**\n- 📞 Call your bot from any phone\n- 🔐 Caller ID authentication + voice PIN security\n- 🛡️ Call screening (whitelist-based)\n- 🧠 Full memory context (loads MEMORY.md, USER.md)\n- 💰 Cost tracking per call\n- 📝 Call transcripts with summaries\n- ⏱️ Rate limiting\n- 🌐 Permanent tunnel (Cloudflare) or temporary (ngrok)\n\n## Architecture\n\n```\nPhone → Twilio → ElevenLabs Agent → Your Bridge → Anthropic Claude → OpenClaw Tools\n                                          ↓\n                                    Memory Context\n                                    (MEMORY.md, USER.md)\n```\n\n**Flow:**\n1. Caller dials your Twilio number\n2. Twilio routes to ElevenLabs Agent\n3. Agent sends chat completions to your bridge (mimics OpenAI API)\n4. Bridge translates to Anthropic, injects context from memory files\n5. Claude response → ElevenLabs TTS → caller hears it\n\n## Prerequisites\n\n- OpenClaw installed and running\n- ElevenLabs account + API key\n- Twilio account + phone number\n- Anthropic API key\n- Cloudflare tunnel **or** ngrok (for exposing localhost)\n\n## Setup\n\n### 1. Enable Chat Completions in OpenClaw\n\nNot needed for this skill — the bridge bypasses OpenClaw and calls Claude directly. This gives you more control over memory injection and cost tracking.\n\n### 2. Create the Bridge Server\n\nThe bridge is a FastAPI server that:\n- Accepts OpenAI-compatible `/v1/chat/completions` requests from ElevenLabs\n- Injects memory context (MEMORY.md, USER.md, live data)\n- Calls Anthropic Claude API\n- Streams responses back in OpenAI format\n- Logs costs and transcripts\n\n**Key files:**\n- `server.py` — FastAPI app with /v1/chat/completions endpoint\n- `fred_prompt.py` — System prompt builder (loads memory files)\n- `.env` — Secrets (API keys, tokens, whitelist)\n- `contacts.json` — Caller whitelist for screening\n\n### 3. Set Up Cloudflare Tunnel (Recommended)\n\nPermanent, secure alternative to ngrok:\n\n```bash\n# Install cloudflared\nbrew install cloudflare/cloudflare/cloudflared\n\n# Login and configure\ncloudflared tunnel login\ncloudflared tunnel create <tunnel-name>\n\n# Run the tunnel\ncloudflared tunnel --url http://localhost:8013 run <tunnel-name>\n```\n\nAdd a CNAME in Cloudflare DNS:\n```\nvoice.yourdomain.com → <tunnel-id>.cfargotunnel.com\n```\n\n**Or use ngrok (temporary):**\n```bash\nngrok http 8013\n```\n\n### 4. Configure ElevenLabs Agent\n\n#### Option A: Manual (UI)\n1. Go to ElevenLabs dashboard → Conversational AI\n2. Create new agent\n3. Under LLM settings → Custom LLM\n4. Set URL: `https://voice.yourdomain.com/v1/chat/completions`\n5. Add header: `Authorization: Bearer <YOUR_BRIDGE_TOKEN>`\n\n#### Option B: Programmatic (API)\n\n```bash\n# Step 1: Store your bridge auth token as a secret\ncurl -X POST https://api.elevenlabs.io/v1/convai/secrets \\\n  -H \"xi-api-key: YOUR_ELEVENLABS_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"type\": \"new\",\n    \"name\": \"bridge_auth_token\",\n    \"value\": \"YOUR_BRIDGE_AUTH_TOKEN\"\n  }'\n\n# Response: {\"secret_id\": \"abc123...\"}\n\n# Step 2: Create the agent\ncurl -X POST https://api.elevenlabs.io/v1/convai/agents/create \\\n  -H \"xi-api-key: YOUR_ELEVENLABS_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"conversation_config\": {\n      \"agent\": {\n        \"language\": \"en\",\n        \"prompt\": {\n          \"llm\": \"custom-llm\",\n          \"prompt\": \"You are a helpful voice assistant.\",\n          \"custom_llm\": {\n            \"url\": \"https://voice.yourdomain.com/v1/chat/completions\",\n            \"api_key\": {\"secret_id\": \"abc123...\"}\n          }\n        }\n      }\n    }\n  }'\n```\n\n### 5. Connect Twilio Phone Number\n\nIn ElevenLabs agent settings:\n1. Go to **Phone** section\n2. Enter Twilio Account SID and Auth Token\n3. Select your Twilio phone number\n4. Save\n\nDone! Your bot now answers that phone number.\n\n## Security Features\n\n### Caller ID Authentication\nRecognizes whitelisted numbers automatically:\n```json\n// contacts.json\n{\n  \"+12505551234\": {\n    \"name\": \"Alice\",\n    \"role\": \"family\"\n  }\n}\n```\n\n### Voice PIN Challenge\nFor unknown callers or high-security actions:\n```python\nVOICE_PIN = \"banana\"  # Set in .env\n```\n\nCaller must say the PIN to proceed.\n\n### Call Screening\nUnknown numbers get a receptionist prompt:\n> \"This is Fred's assistant. I can take a message or help with general questions.\"\n\n### Rate Limiting\nConfigurable per-hour limits:\n```python\nRATE_LIMIT_PER_HOUR = 10\n```\n\nPrevents abuse and runaway costs.\n\n## Memory Injection\n\nThe bridge auto-loads context before each call:\n\n**Files read:**\n- `MEMORY.md` — Long-term facts about user, projects, preferences\n- `USER.md` — User profile (name, location, timezone)\n- Recent call transcripts (cross-call memory)\n\n**Live data injection:**\n- Current time/date\n- Weather (optional, via API)\n- Calendar events (optional, via gog CLI)\n\nAll injected into the system prompt before Claude sees the conversation.\n\n## Cost Tracking\n\nEvery call logs to `memory/voice-calls/costs.jsonl`:\n\n```json\n{\n  \"call_sid\": \"CA123...\",\n  \"timestamp\": \"2026-02-03T10:30:00\",\n  \"caller\": \"+12505551234\",\n  \"duration_sec\": 45,\n  \"total_cost_usd\": 0.12,\n  \"breakdown\": {\n    \"twilio\": 0.02,\n    \"elevenlabs\": 0.08,\n    \"anthropic\": 0.02\n  }\n}\n```\n\nRun analytics on the JSONL to track monthly spend.\n\n## Usage Example\n\n**Call your bot:**\n1. Dial your Twilio number\n2. If you're whitelisted → casual conversation starts\n3. If you're unknown → receptionist mode\n4. Ask it to check your calendar, send a message, set a reminder, etc.\n\n**Outbound calling (optional):**\n```bash\ncurl -X POST https://voice.yourdomain.com/call/outbound \\\n  -H \"Authorization: Bearer <BRIDGE_TOKEN>\" \\\n  -d '{\"to\": \"+12505551234\", \"message\": \"Reminder: dentist at 3pm\"}'\n```\n\n## Configuration Options\n\n**Environment variables (.env):**\n```bash\nANTHROPIC_API_KEY=sk-ant-...\nELEVENLABS_API_KEY=sk_...\nELEVENLABS_AGENT_ID=agent_...\nTWILIO_ACCOUNT_SID=AC...\nTWILIO_AUTH_TOKEN=...\nTWILIO_NUMBER=+1...\nLLM_BRIDGE_TOKEN=<random-secure-token>\nVOICE_PIN=<your-secret-word>\nCLAWD_DIR=/path/to/clawd\n```\n\n**Whitelist (contacts.json):**\n```json\n{\n  \"+12505551234\": {\"name\": \"Alice\", \"role\": \"family\"},\n  \"+12505555678\": {\"name\": \"Bob\", \"role\": \"friend\"}\n}\n```\n\n## Advanced: Office Hours\n\nRestrict calls to business hours:\n\n```python\n# In server.py\nOFFICE_HOURS = {\n    \"enabled\": True,\n    \"timezone\": \"America/Vancouver\",\n    \"weekdays\": {\"start\": \"09:00\", \"end\": \"17:00\"},\n    \"weekends\": False\n}\n```\n\nOutside hours → voicemail prompt.\n\n## Debugging\n\n**Test the bridge directly:**\n```bash\ncurl -X POST https://voice.yourdomain.com/v1/chat/completions \\\n  -H \"Authorization: Bearer <BRIDGE_TOKEN>\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"claude-sonnet-4\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}],\n    \"stream\": false\n  }'\n```\n\n**Check logs:**\n```bash\ntail -f ~/clawd/memory/voice-calls/bridge.log\n```\n\n**Verify Twilio webhook:**\n1. Call your number\n2. Check Twilio console → Call logs → Webhook status\n3. Should see 200 responses from ElevenLabs\n\n## Cost Estimates\n\n**Per-minute breakdown:**\n- Twilio: ~$0.01/min (inbound) + carrier fees\n- ElevenLabs TTS: ~$0.05/min (varies by voice quality)\n- Anthropic Claude: ~$0.01/min (depends on token usage)\n- **Total: ~$0.07-0.10/min** (~$4-6/hour of talk time)\n\nUse rate limiting and call screening to control costs.\n\n## Comparison: This vs Basic Tutorial\n\n**ElevenLabs official tutorial:**\n- ✅ Basic integration\n- ❌ No security\n- ❌ No memory persistence\n- ❌ No cost tracking\n- ❌ Temporary ngrok URL\n\n**This skill (Phone Voice v2.0):**\n- ✅ All of the above\n- ✅ Caller ID + PIN security\n- ✅ Cross-call memory\n- ✅ Cost tracking & analytics\n- ✅ Permanent tunnel (Cloudflare)\n- ✅ Rate limiting\n- ✅ Call screening\n- ✅ Transcript logging\n\n## Links\n\n- ElevenLabs Agents: https://elevenlabs.io/conversational-ai\n- Twilio: https://www.twilio.com/\n- Cloudflare Tunnels: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/\n- Reference implementation: (Available on request — DM @FredMolty)\n\n## License\n\nMIT — use freely, credit appreciated.\n\n---\n\n**Built by Fred (@FredMolty) — running on OpenClaw since 2026.**\n","tags":{"elevenlabs":"2.0.0","latest":"2.0.0","phone":"2.0.0","security":"2.0.0","twilio":"2.0.0","voice":"2.0.0"},"stats":{"comments":0,"downloads":3373,"installsAllTime":14,"installsCurrent":14,"stars":4,"versions":1},"createdAt":1770177281401,"updatedAt":1779076645330},"latestVersion":{"version":"2.0.0","createdAt":1770177281401,"changelog":"**Major upgrade with new features and security enhancements.**\n\n- Adds caller ID authentication and voice PIN security.\n- Introduces call screening, configurable whitelist, and rate limiting.\n- Full memory injection from files and recent transcripts before each call.\n- Tracks costs per call and logs detailed breakdowns.\n- Supports permanent (Cloudflare) or temporary (ngrok) tunnels.\n- Hands-off OpenClaw chat completions—bridge now connects directly to Anthropic Claude.","license":null},"metadata":null,"owner":{"handle":"cortexuvula","userId":"s1708xwjmpxwt0jkkps10s75m983tz6q","displayName":"Roaming","image":"https://avatars.githubusercontent.com/u/2161372?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779947122441}}