通过 REST API 调用 Twilio 挂断电话不起作用? [英] Twilio hangup call through REST API not working?

查看:29
本文介绍了通过 REST API 调用 Twilio 挂断电话不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当电话处于排队状态(振铃或已启动)时如何挂断电话?下面的代码对通话没有任何影响,通话会持续响铃直到接听者接听.有时当座席意识到他们拨错了号码时,他们需要一种方法在响铃过程中挂断电话.

How to hang up the call whent it's status is in queued state(ringing or initiated)? None of the codes below have any effect on call, call continues to ring untill receiver picks up.Sometimes when agent realizes they are dialing wrong number they need a way to hangup the call in the middle of ringing.

PHP 代码

$client->calls($callRecord->call_sid)->update([
  'status' => 'canceled'
]);

$client->calls($callRecord->call_sid)->update([
  'status' => 'completed'
]);

$client->calls($callRecord->call_sid)->update([
   'url' => 'mywebsite.com/tw-hangup'
]);

推荐答案

请参阅以下 Twilio 文档:

See the following Twilio Documentation:

Voice API:调用(最后一段最相关)https://www.twilio.com/docs/voice/api/call

Voice API: Call (the last paragraph is most relevant) https://www.twilio.com/docs/voice/api/call

当您将活动呼叫重定向到另一个电话号码时,Twilio 会为该新电话号码创建一个全新的 Call 实例.原始呼叫是父呼叫,拨打的任何其他号码都会建立子呼叫.父子呼叫将具有唯一标识呼叫 SID.

When you redirect an active call to another phone number, Twilio creates an entirely new Call instance for that new phone number. The original call is the parent call, and any additional number dialed establishes a child call. Parent and child calls will have uniquely identifying Call SIDs.

请注意,Twilio 认为当前执行 a 的任何父调用都在进行中.即使您已将初始呼叫重定向到新号码,父呼叫仍处于活动状态,因此您必须使用 Status=completed 来结束它.

Note that any parent call currently executing a is considered in-progress by Twilio. Even if you've re-directed your initial call to a new number, the parent call is still active, and thus you must use Status=completed to end it.

无法通过 REST API 取消未应答的子调用,但可以修改父调用以指向新的 TwiML.此操作将结束子呼叫.

Unanswered child calls cannot be canceled via the REST API, but the parent call can be modified to point to new TwiML. This action will end the child call.

这篇关于通过 REST API 调用 Twilio 挂断电话不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆