Twilio hangup call through REST API not working?

北城以北 提交于 2019-12-08 04:07:44

问题


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 code

$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'
]);

回答1:


See the following Twilio Documentation:

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

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.

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.

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.



来源:https://stackoverflow.com/questions/51681064/twilio-hangup-call-through-rest-api-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!