【问题标题】:TwiML response body too large Error 11750 laravelTwiML 响应正文太大错误 11750 laravel
【发布时间】:2020-04-14 10:56:10
【问题描述】:
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Twilio\Rest\Client;
use Twilio\TwiML\VoiceResponse;

class HomeController extends Controller
{
// call process
    public function welcome(Request $request)
    {
        $twiml = new VoiceResponse();
        if(isset($request->Digits)){
            switch($request->Digits){
                case 1:
                    $twiml->say('thank you calling us');
                    break;
                default:
                    $twiml->say('You have entered wrong key');
                    break;
            }
        } else{
            $twiml->say(
                'Thank you for calling Call Congress! Press 1 for Connect the call.'
            )->gather([
                'numDigits' => 1,
                'action' => $this->endCall();
            ]);
            /*$gather = $twiml->gather(array('numDigits' => 1));
            $gather->say('Thank you for calling us. Press 1 to continue the call.');*/
        }

        return $twiml;
    }

    public static function endCall()
    {
        $twiml = new Twiml();

        $twiml->say(
            'Thank you for using Call Congress! ' .
            'Your voice makes a difference. Goodbye.'
        )->hangup();

        return $twiml;
    }
}

我收到一条错误消息,“在您对 Twilio 请求的响应中,响应正文大于 64 kB。 '。可能的原因 您提供的 TwiML 大于 64 kB 或您在响应中提供非 TwiML 内容。提前致谢。

【问题讨论】:

  • 使用浏览器或 Postman 并点击您的端点。您认为响应是什么?
  • 我在浏览器和邮递员中都打过。但它在浏览器中正常工作。更多详情可以查看截图地址(prnt.sc/rz2q5u)。

标签: php laravel twilio twilio-php twilio-twiml


【解决方案1】:

通常这意味着您的应用程序正在崩溃并将堆栈跟踪返回给 Twilio 以执行,从而导致此错误。

【讨论】:

  • 你好艾伦。感谢您的支持。但是这个应用程序在我的浏览器中运行正常。当我打电话给 twilio 号码时,它在 twilio 调试器中给了我错误。当我在浏览器中运行它时,它可以正常工作。有关更多详细信息,您可以找到附加的屏幕网址(prnt.sc/rz2q5u)。
  • Twilio 默认使用 POST 方法。您的浏览器仅使用 GET。您可以告诉 Twilio 使用 GET 或如 Alex 所述,下载 Postman 并使用 POST 测试您的应用程序。
  • 谢谢它现在正在工作。我正在使用 get 方法,现在我已将其转换为 post 方法,现在它正在工作。再次感谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-12
  • 2013-12-15
  • 1970-01-01
  • 2017-10-28
  • 2012-05-10
  • 2017-10-11
相关资源
最近更新 更多