我想使用twilio来测试我们的内部电话系统,并确保电话正在路由,因为我们的提供商通知我们遇到问题是出了名的。
我可以从twilio发起一个电话,使用“聚集”动词来录制语音(以确保我们找到正确的队列),然后挂机。一切正常。除了聚会最终需要花费2分钟来收听来自我们的电话系统的整个消息,我们收取8 15秒的时间收集块。我只需要前15秒,但无法弄清楚如何更快挂断。是否有一种简单的方法可以限制特定时间的呼叫?
timeLimit和timeout都不适用于此,因为timeLimit仅在拨号动词内部有效,而超时仅适用于聚集期间语音中的暂停。
答案 0 :(得分:0)
也许只需在代码中设置一个计时器15秒左右,然后使用/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}
Status=Completed
取消通话(使用var returndateyes = document.getElementById("content_1_form_F5E9D36B22E24CA2A7A8E858D4952AEF_field_7C9F9E2157994A2A84FE73D9389C76AAscope_0"),
returndateno = document.getElementById("content_1_form_F5E9D36B22E24CA2A7A8E858D4952AEF_field_7C9F9E2157994A2A84FE73D9389C76AAscope_1"),
returndatecal = document.getElementById("content_1_form_F5E9D36B22E24CA2A7A8E858D4952AEF_field_3C4945224E184A9B9E3B6ABBB6D8A423_scope"),
multitripyes = document.getElementById("content_1_form_F5E9D36B22E24CA2A7A8E858D4952AEF_field_3A796ED80E744BDD9720E4ADAC8DCC5Escope_0"),
multitripno = document.getElementById("content_1_form_F5E9D36B22E24CA2A7A8E858D4952AEF_field_3A796ED80E744BDD9720E4ADAC8DCC5Escope_1"),
secondtripdate = document.getElementById("content_1_form_F5E9D36B22E24CA2A7A8E858D4952AEF_field_FB04828F69244ADB822E8C1CD36477EE_scope"),
thirdtripdate = document.getElementById("content_1_form_F5E9D36B22E24CA2A7A8E858D4952AEF_field_FDE38F6B8C2E4A788728550A2DECA132_scope");
returndatecal.style.display = "none";
secondtripdate.style.display = "none";
thirdtripdate.style.display = "none";
returndateyes.onclick = function() {
returndatecal.style.display = returndateyes.checked ? "block" : "none";
};
returndateno.onclick = function() {
returndatecal.style.display = returndateno.checked ? "none" : "block";
};
multitripyes.onclick = function() {
multitripyes.checked ? (secondtripdate.style.display = "block", thirdtripdate.style.display = "block") : (secondtripdate.style.display = "none", thirdtripdate.style.display = "none");
};
multitripno.onclick = function() {
multitripno.checked ? (secondtripdate.style.display = "none", thirdtripdate.style.display = "none") : (secondtripdate.style.display = "block", thirdtripdate.style.display = "block");
};
参数即可取消通话如果他们正在进行中。)
答案 1 :(得分:0)
如果您使用他们的Ruby SDK,并进行正常通话(而非电话会议),那么您可以使用update
方法:
client = Twilio::REST::Client.new(account_sid, auth_token)
# fetch all in-progress calls between the two numbers
client.calls.list(from: '+11231231234',
to: '+12312311234',
status: 'in-progress').each do |c| #it's supposed to be just one record, but you can play it safe
c.update(status: 'completed')
end
completed
会挂断电话。canceled
会挂断电话。如果您确定该呼叫正在进行且您知道呼叫sid,那么您可以使用:
client = Twilio::REST::Client.new(account_sid, auth_token)
in_progress_call = client.calls(call_sid).fetch
in_progress_call.update(status: 'completed') if in_progress_call.present?
the official docs中有一些一般信息。其他SDK也提供了片段。
您可以找到source code of the update method here了解更多详情。