用户收到一个铃声后,Twilio 呼叫断开

Twillio call disconnect after the user recieves one ring

我想在呼叫初始化并且用户得到一个响铃后立即终止呼叫

这是我的路线

Route::any('missedCall','RegistrationController@missedCall');
Route::any('callForMissedCall',function(){
    $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?   ><Response/>');
    $xml->addChild('Dial timeout="0"');
    $header['Content-Type'] = 'application/xml';
    return Response::make($xml->asXML(), '200', $header);
});

以及我用第一条路线调用的函数

    public function missedCall(Request $request)
    {
        $data = $request->all();
        if (isset($data['id'])) {
            Response::json(array("status"=>'failure',"msg"=>'Missing    argument'));
        }
        $regDetails = RegistrationDetails::find($data['id']);

        if (!$regDetails)
            return Response::json(array("status"=>"failure","msg"=>"No     data is present"));
        $phone_no = $regDetails->phone_no;
        $country = $regDetails->country;
        if (!$country)
            return    Response::json(array("status"=>"failure","msg"=>"Country missing"));
        $countryData = Country::where('name',"LIKE",$country)->first();

        $phnCode = $countryData->phonecode;
        $phone = "+".$phnCode.$phone_no;
        $twilio = Twilio::call($phone,     $_ENV['app_url']."/callForMissedCall");
     }

以上代码仅在用户摘机后终止。关于这个的任何解决方案..提前致谢

关注此 link 来自 twillio https://www.twilio.com/docs/api/twiml/dial
我能够实现调用。终止调用不太可能,但可以按照我的代码查看我是如何实现这一点的

    public function missedCall($id)
{
    if (isset($id)) {
        Response::json(array("status"=>'failure',"msg"=>'Missing argument'));
    }
    $regDetails = RegistrationDetails::find($id);

    if (!$regDetails)
        return Response::json(array("status"=>"failure","msg"=>"No data is present"));
    $phone_no = $regDetails->phone_no;
    $country = $regDetails->country;
    if (!$country)
        return Response::json(array("status"=>"failure","msg"=>"Country missing"));
    $countryData = Country::where('name',"LIKE",$country)->first();

    $phnCode = $countryData->phonecode;
    $phone = "+".$phnCode.$phone_no;
    $twilio = Twilio::call($phone, $_ENV['app_url']."/callForMissedCall");
}

在xml部分

   Route::any('callForMissedCall',function(){
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><Response/>');
$xml->addChild('Dial');
$header['Content-Type'] = 'application/xml';
return Response::make($xml->asXML(), '200', $header);

});

这里是 Twilio 布道者。

我们刚刚推出了一项名为 Call Progress Events 的新功能,可在通话过程中为您提供更精细的通知。我不确定我们能否让您知道一个电话只响了一次,但我知道我们可以告诉您它是 "ringing" 与 "answered"。

如果您检测到 "ringing",您可以随后终止通话。

希望对您有所帮助。