我正在尝试使用 Twilio Programmable Voice 在我的应用程序中创建客户端到客户端:
但看起来 Twilio 总是返回“响铃”,即使被叫方断开连接(我关闭网络甚至卸载应用程序)
我的服务器/makecall函数:
dial := &twiml.VoiceDial{}
client := &twiml.VoiceClient{
Identity: to,
StatusCallbackEvent: "initiated ringing answered completed",
StatusCallback: "https://mydemo.app/callstatus",
StatusCallbackMethod: "POST",
}
dial.AnswerOnBridge = "true"
dial.CallerId = from
dial.InnerElements = []twiml.Element{client}
verbList := []twiml.Element{dial}
twimlResult, err := twiml.Voice(verbList)
if err != nil {
return ""
}
return twimlResult
/callstatus 被调用 3 次,参数数据如下:
首先发起
ApiVersion "2010-04-01"
Called "client:Callee1"
ParentCallSid "CA6fe3xxx"
CallStatus **"initiated"**
From "client:Caller1"
Direction "outbound-dial"
Timestamp "Sun, 23 Apr 2023 04:01:16 +0000"
AccountSid "ACaxxx"
CallbackSource "call-progress-events"
Caller "client:Caller1"
SequenceNumber "0"
CallSid "CA306daxxx"
To "client:Callee1"
第二次调用状态回调:
ApiVersion "2010-04-01"
Called "client:Callee1"
ParentCallSid "CA6fexxx"
CallStatus **"ringing"**
From "client:Caller1"
Direction "outbound-dial"
Timestamp "Sun, 23 Apr 2023 04:01:17 +0000"
AccountSid "ACa19740xxx"
CallbackSource "call-progress-events"
Caller "client:Caller1"
SequenceNumber "1"
CallSid "CA306xxx"
To "client:Callee1"
最终通话状态回调:
ApiVersion "2010-04-01"
Called "client:Callee1"
ParentCallSid "CA6xxx3"
CallStatus **"no-answer"**
Duration "0"
From "client:Caller1"
Direction "outbound-dial"
CallDuration "0"
Timestamp "Sun, 23 Apr 2023 04:01:23 +0000"
AccountSid "ACa1xxx"
CallbackSource "call-progress-events"
SipResponseCode "487"
Caller "client:Caller1"
SequenceNumber "2"
CallSid "CA3xxx"
To "client:Callee1"
想知道如果被叫方断开连接,为什么 CallStatus 返回“正在响铃”?
尝试使用 Twilio SDK 处理移动应用程序上的呼叫流程