Voice Call(插件)

通过插件为 OpenClaw 提供语音通话。支持出站通知和带有入站策略的多轮对话。

当前提供商:

  • twilio(Programmable Voice + Media Streams)
  • telnyx(Call Control v2)
  • plivo(Voice API + XML transfer + GetInput speech)
  • mock(开发/无网络)

快速心智模型:

  • 安装插件
  • 重启 Gateway 网关
  • plugins.entries.voice-call.config 下配置
  • 使用 openclaw voicecall ...voice_call 工具

运行位置(本地 vs 远程)

Voice Call 插件运行在 Gateway 网关进程内部

如果你使用远程 Gateway 网关,在运行 Gateway 网关的机器上安装/配置插件,然后重启 Gateway 网关以加载它。

安装

选项 A:从 npm 安装(推荐)

  1. openclaw plugins install @openclaw/voice-call

之后重启 Gateway 网关。

选项 B:从本地文件夹安装(开发,不复制)

  1. openclaw plugins install ./extensions/voice-call
  2. cd ./extensions/voice-call && pnpm install

之后重启 Gateway 网关。

配置

plugins.entries.voice-call.config 下设置配置:

  1. {
  2. plugins: {
  3. entries: {
  4. "voice-call": {
  5. enabled: true,
  6. config: {
  7. provider: "twilio", // 或 "telnyx" | "plivo" | "mock"
  8. fromNumber: "+15550001234",
  9. toNumber: "+15550005678",
  10. twilio: {
  11. accountSid: "ACxxxxxxxx",
  12. authToken: "...",
  13. },
  14. plivo: {
  15. authId: "MAxxxxxxxxxxxxxxxxxxxx",
  16. authToken: "...",
  17. },
  18. // Webhook 服务器
  19. serve: {
  20. port: 3334,
  21. path: "/voice/webhook",
  22. },
  23. // 公开暴露(选一个)
  24. // publicUrl: "https://example.ngrok.app/voice/webhook",
  25. // tunnel: { provider: "ngrok" },
  26. // tailscale: { mode: "funnel", path: "/voice/webhook" }
  27. outbound: {
  28. defaultMode: "notify", // notify | conversation
  29. },
  30. streaming: {
  31. enabled: true,
  32. streamPath: "/voice/stream",
  33. },
  34. },
  35. },
  36. },
  37. },
  38. }

注意事项:

  • Twilio/Telnyx 需要可公开访问的 webhook URL。
  • Plivo 需要可公开访问的 webhook URL。
  • mock 是本地开发提供商(无网络调用)。
  • skipSignatureVerification 仅用于本地测试。
  • 如果你使用 ngrok 免费版,将 publicUrl 设置为确切的 ngrok URL;签名验证始终强制执行。
  • tunnel.allowNgrokFreeTierLoopbackBypass: true 允许带有无效签名的 Twilio webhooks,仅当 tunnel.provider="ngrok"serve.bind 是 loopback(ngrok 本地代理)时。仅用于本地开发。
  • Ngrok 免费版 URL 可能会更改或添加中间页面行为;如果 publicUrl 漂移,Twilio 签名将失败。对于生产环境,优先使用稳定域名或 Tailscale funnel。

通话的 TTS

Voice Call 使用核心 messages.tts 配置(OpenAI 或 ElevenLabs)进行通话中的流式语音。你可以在插件配置下使用相同的结构覆盖它——它会与 messages.tts 深度合并。

  1. {
  2. tts: {
  3. provider: "elevenlabs",
  4. elevenlabs: {
  5. voiceId: "pMsXgVXv3BLzUgSXRplE",
  6. modelId: "eleven_multilingual_v2",
  7. },
  8. },
  9. }

注意事项:

  • 语音通话忽略 Edge TTS(电话音频需要 PCM;Edge 输出不可靠)。
  • 当启用 Twilio 媒体流时使用核心 TTS;否则通话回退到提供商原生语音。

更多示例

仅使用核心 TTS(无覆盖):

  1. {
  2. messages: {
  3. tts: {
  4. provider: "openai",
  5. openai: { voice: "alloy" },
  6. },
  7. },
  8. }

仅为通话覆盖为 ElevenLabs(其他地方保持核心默认):

  1. {
  2. plugins: {
  3. entries: {
  4. "voice-call": {
  5. config: {
  6. tts: {
  7. provider: "elevenlabs",
  8. elevenlabs: {
  9. apiKey: "elevenlabs_key",
  10. voiceId: "pMsXgVXv3BLzUgSXRplE",
  11. modelId: "eleven_multilingual_v2",
  12. },
  13. },
  14. },
  15. },
  16. },
  17. },
  18. }

仅为通话覆盖 OpenAI 模型(深度合并示例):

  1. {
  2. plugins: {
  3. entries: {
  4. "voice-call": {
  5. config: {
  6. tts: {
  7. openai: {
  8. model: "gpt-4o-mini-tts",
  9. voice: "marin",
  10. },
  11. },
  12. },
  13. },
  14. },
  15. },
  16. }

入站通话

入站策略默认为 disabled。要启用入站通话,设置:

  1. {
  2. inboundPolicy: "allowlist",
  3. allowFrom: ["+15550001234"],
  4. inboundGreeting: "Hello! How can I help?",
  5. }

自动响应使用智能体系统。通过以下方式调整:

  • responseModel
  • responseSystemPrompt
  • responseTimeoutMs

CLI

  1. openclaw voicecall call --to "+15555550123" --message "Hello from OpenClaw"
  2. openclaw voicecall continue --call-id <id> --message "Any questions?"
  3. openclaw voicecall speak --call-id <id> --message "One moment"
  4. openclaw voicecall end --call-id <id>
  5. openclaw voicecall status --call-id <id>
  6. openclaw voicecall tail
  7. openclaw voicecall expose --mode funnel

智能体工具

工具名称:voice_call

操作:

  • initiate_call(message、to?、mode?)
  • continue_call(callId、message)
  • speak_to_user(callId、message)
  • end_call(callId)
  • get_status(callId)

此仓库在 skills/voice-call/SKILL.md 提供了配套的 skill 文档。

Gateway 网关 RPC

  • voicecall.initiateto?messagemode?
  • voicecall.continuecallIdmessage
  • voicecall.speakcallIdmessage
  • voicecall.endcallId
  • voicecall.statuscallId