mirror of
https://github.com/hanzoai/bot.git
synced 2026-11-01 18:02:28 +00:00
Three coordinated things:
1. Resolve the committed upstream/main merge conflicts. 94 files were
sitting with raw <<<<<<< HEAD ... >>>>>>> upstream/main blocks. Every
conflict had HanzoBot/Bot on HEAD and OpenClaw on upstream. Resolved
by keeping HEAD everywhere — 540 conflict blocks.
2. Rewrite remaining OpenClaw text refs.
OPENCLAW → HANZO_BOT
OpenClaw → HanzoBot (PascalCase type identifiers)
openclaw → bot (codebase convention — botToken,
botUsername etc.; avoids invalid
hyphenated JS identifiers)
openclaw[_]/openclaw[A-Z] → bot[_]/bot[A-Z] (compound)
ai.openclaw.x → ai.hanzo.bot.x (JVM package path)
3. Delete or rename openclaw-named file paths (116 of them). Dead
duplicates with a Bot-named canonical from the partial migration:
deleted. Otherwise renamed.
ai/openclaw/** → deleted (ai/hanzo/bot/** canonical)
Sources/OpenClaw*/ → deleted (Sources/Bot* canonical)
Tests/OpenClawIPCTests/ → deleted (Tests/BotIPCTests canonical)
OpenClawKit/ → deleted (BotKit canonical)
openclaw-tools.*.ts → deleted (bot-tools.*.ts canonical)
openclaw-root.ts etc. → deleted (bot-root.ts canonical)
types.openclaw.ts → deleted (types.bot.ts canonical)
extensions/*/openclaw.plugin.json → renamed hanzo-bot.plugin.json
docs/start/openclaw.md → renamed hanzo-bot.md (+ zh-CN)
docs/assets/openclaw-*.png, whatsapp-openclaw*.jpg → deleted
scripts/.../openclaw-* → deleted (bot/hanzo-bot parallels)
openclaw.mjs → deleted (hanzo-bot.mjs is package.bin)
Then patched 65 broken JS/TS import strings where hanzo-bot had ended
up inside an import path ('./types.hanzo-bot.js' → './types.bot.js'
etc., since the on-disk filename uses the brand-neutral bot- prefix).
Pre-existing lint debt cleaned up to get oxlint --type-aware to 0/0:
removed the dead i18n test that referenced a path no longer existing;
defined the missing DIDConfig and WalletConfig types in types.base.ts
(they were imported but never declared); dropped unused imports;
collapsed redundant type assertion and a tautological meta.bot lookup
that the openclaw→bot rename made redundant.
The a2ui.bundle.js generated artifact is kept at its pre-rebrand
contents — it gets regenerated by 'pnpm canvas:a2ui:bundle' from
sources I cannot rebuild in this commit; the source side is clean.
Verified: 0 occurrences of openclaw (case-insensitive) in tree source
content, 0 file or directory paths with openclaw in the name; oxlint
--type-aware src test reports 0/0.
6.1 KiB
6.1 KiB
read_when, summary, title, x-i18n
| read_when | summary | title | x-i18n | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Voice Call 插件:通过 Twilio/Telnyx/Plivo 进行出站 + 入站通话(插件安装 + 配置 + CLI) | Voice Call 插件 |
|
Voice Call(插件)
通过插件为 HanzoBot 提供语音通话。支持出站通知和带有入站策略的多轮对话。
当前提供商:
twilio(Programmable Voice + Media Streams)telnyx(Call Control v2)plivo(Voice API + XML transfer + GetInput speech)mock(开发/无网络)
快速心智模型:
- 安装插件
- 重启 Gateway 网关
- 在
plugins.entries.voice-call.config下配置 - 使用
hanzo-bot voicecall ...或voice_call工具
运行位置(本地 vs 远程)
Voice Call 插件运行在 Gateway 网关进程内部。
如果你使用远程 Gateway 网关,在运行 Gateway 网关的机器上安装/配置插件,然后重启 Gateway 网关以加载它。
安装
选项 A:从 npm 安装(推荐)
hanzo-bot plugins install @hanzo/bot-voice-call
之后重启 Gateway 网关。
选项 B:从本地文件夹安装(开发,不复制)
hanzo-bot plugins install ./extensions/voice-call
cd ./extensions/voice-call && pnpm install
之后重启 Gateway 网关。
配置
在 plugins.entries.voice-call.config 下设置配置:
{
plugins: {
entries: {
"voice-call": {
enabled: true,
config: {
provider: "twilio", // 或 "telnyx" | "plivo" | "mock"
fromNumber: "+15550001234",
toNumber: "+15550005678",
twilio: {
accountSid: "ACxxxxxxxx",
authToken: "...",
},
plivo: {
authId: "MAxxxxxxxxxxxxxxxxxxxx",
authToken: "...",
},
// Webhook 服务器
serve: {
port: 3334,
path: "/voice/webhook",
},
// 公开暴露(选一个)
// publicUrl: "https://example.ngrok.app/voice/webhook",
// tunnel: { provider: "ngrok" },
// tailscale: { mode: "funnel", path: "/voice/webhook" }
outbound: {
defaultMode: "notify", // notify | conversation
},
streaming: {
enabled: true,
streamPath: "/voice/stream",
},
},
},
},
},
}
注意事项:
- 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 深度合并。
{
tts: {
provider: "elevenlabs",
elevenlabs: {
voiceId: "pMsXgVXv3BLzUgSXRplE",
modelId: "eleven_multilingual_v2",
},
},
}
注意事项:
- 语音通话忽略 Edge TTS(电话音频需要 PCM;Edge 输出不可靠)。
- 当启用 Twilio 媒体流时使用核心 TTS;否则通话回退到提供商原生语音。
更多示例
仅使用核心 TTS(无覆盖):
{
messages: {
tts: {
provider: "openai",
openai: { voice: "alloy" },
},
},
}
仅为通话覆盖为 ElevenLabs(其他地方保持核心默认):
{
plugins: {
entries: {
"voice-call": {
config: {
tts: {
provider: "elevenlabs",
elevenlabs: {
apiKey: "elevenlabs_key",
voiceId: "pMsXgVXv3BLzUgSXRplE",
modelId: "eleven_multilingual_v2",
},
},
},
},
},
},
}
仅为通话覆盖 OpenAI 模型(深度合并示例):
{
plugins: {
entries: {
"voice-call": {
config: {
tts: {
openai: {
model: "gpt-4o-mini-tts",
voice: "marin",
},
},
},
},
},
},
}
入站通话
入站策略默认为 disabled。要启用入站通话,设置:
{
inboundPolicy: "allowlist",
allowFrom: ["+15550001234"],
inboundGreeting: "Hello! How can I help?",
}
自动响应使用智能体系统。通过以下方式调整:
responseModelresponseSystemPromptresponseTimeoutMs
CLI
hanzo-bot voicecall call --to "+15555550123" --message "Hello from HanzoBot"
hanzo-bot voicecall continue --call-id <id> --message "Any questions?"
hanzo-bot voicecall speak --call-id <id> --message "One moment"
hanzo-bot voicecall end --call-id <id>
hanzo-bot voicecall status --call-id <id>
hanzo-bot voicecall tail
hanzo-bot 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.initiate(to?、message、mode?)voicecall.continue(callId、message)voicecall.speak(callId、message)voicecall.end(callId)voicecall.status(callId)