Twilio Voice 触发器
通过 Twilio Voice 接收来电时触发工作流
通过 Twilio Voice 接收来电时触发工作流
这是基于 webhook 的触发器。请将外部服务配置为向工作流 webhook URL 发送事件。
设置说明
-
在上方输入 TwiML Response,用于告知 Twilio 来电时应执行的操作(例如播放留言、录音、收集输入)。注意:TwiML 标签请使用方括号 [Tag],不要使用尖括号
-
带转录的录音 TwiML 示例:[Response][Say]Please leave a message.[/Say][Record transcribe="true" maxLength="120"/][/Response]
-
打开 Twilio Console 的电话号码页面:https://console.twilio.com/us1/develop/phone-numbers/manage/incoming
-
选择要用于接听来电的电话号码。
-
向下滚动到 "Voice Configuration" 部分。
-
在 "A CALL COMES IN" 字段中选择 "Webhook",并粘贴上方的 Webhook URL。
-
确保 HTTP 方法设置为 POST。
-
点击 "Save configuration"。
-
工作原理:来电时,Twilio 会立即收到你的 TwiML 响应并执行这些指令。工作流在后台运行,可获取来电者信息、通话状态以及任何已录音/已转录的数据。
配置
Twilio 账户 SID*
ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
来自 Twilio 控制台的 Twilio 账户 SID
身份验证令牌*
••••••••
用于 webhook 签名验证的 Twilio 身份验证令牌
TwiML 响应
[Response][Say]请稍候。[/Say][/Response]
立即返回给 Twilio 的 TwiML 指令。请使用方括号代替尖括号(例如用 [Response] 而不是 <Response>)。这用于控制来电时的处理(例如播放消息、录音、收集输入)。你的工作流将在后台执行。
输出架构
事件载荷
callSidstring此次通话的唯一标识符accountSidstringTwilio 账户 SIDfromstring主叫电话号码(E.164 格式)tostring被叫电话号码(你的 Twilio 号码)callStatusstring通话状态(queued、ringing、in-progress、completed 等)directionstring通话方向:inbound 或 outboundapiVersionstringTwilio API 版本callerNamestring主叫名称(如有)forwardedFromstring转接此通话的电话号码digitsstring主叫输入的 DTMF 按键(来自 <Gather>)speechResultstring语音识别结果(若使用带语音的 <Gather>)recordingUrlstring通话录音 URL(如有)recordingSidstring录音 SID(如有)calledstring被叫电话号码(与 "to" 相同)callerstring主叫电话号码(与 "from" 相同)toCitystring被叫号码所在城市toStatestring被叫号码所在州/省toZipstring被叫号码的邮政编码toCountrystring被叫号码所在国家/地区fromCitystring主叫所在城市fromStatestring主叫所在州/省fromZipstring主叫的邮政编码fromCountrystring主叫所在国家/地区calledCitystring被叫号码所在城市(与 toCity 相同)calledStatestring被叫号码所在州(与 toState 相同)calledZipstring被叫号码的邮政编码(与 toZip 相同)calledCountrystring被叫号码所在国家/地区(与 toCountry 相同)callerCitystring主叫所在城市(与 fromCity 相同)callerStatestring主叫所在州(与 fromState 相同)callerZipstring主叫的邮政编码(与 fromZip 相同)callerCountrystring主叫所在国家/地区(与 fromCountry 相同)callTokenstring用于身份验证的 Twilio 通话令牌rawstring来自 Twilio 的完整原始 webhook 载荷,JSON 字符串格式