Plivo - 404错误,未找到呼叫,当我尝试录制入站呼叫时

时间:2018-01-05 13:55:49

标签: php laravel plivo

我正在尝试录制入站电话,但到目前为止,我只是在激活记录时才会收到 404电话未找到错误

这是我目前的代码(我正在使用Laravel和最新的Plivo SDK):

public function __construct(Request $request)
    {
        $this->authId       = config('AUTH_ID');
        $this->authToken    = config('AUTH_TOKEN');
        $this->sourceNumber = config('sms.SMS_SOURCE_NUMBER');
        $this->_answerURL   = config('voiceCall.CALL_ANSWER_URL');
        $this->_recordURL   = config('voiceCall.INBOUND_RECORD_URL');
        $this->_hangupURL   = config('voiceCall.HANGUP_URL');

        $this->_plivo    = new RestClient($this->authId, $this->authToken);

        $this->_response = new Response();

        $this->_mp3Url = 'https://s3.amazonaws.com/plivocloud/Trumpet.mp3';

        $this->_request = $request;

    }

答案方法:

public function answer()
    {
        $response = $this->_response;

        $response->addPlay($this->_mp3Url);

        $response->addRecord([
                'action'            => $this->_recordURL,
                'startOnDialAnswer' => "true",
                'redirect'          => "false",
                'maxLength'        => 600
            ]);

        Log::useDailyFiles(storage_path().'/logs/debug.log');

        Log::info([
            'Record'   => 'This is from inbound answer',
            'Response' => $response
        ]);

        return response($response->toXML(), 200)
            ->header('Content-Type', 'text/xml');
    }

记录方法:

public function record()
    {
        Log::useDailyFiles(storage_path().'/logs/debug.log');


        $uuid = $this->_request->input('CallUUID');

        Log::info(['This is Call UUID' => $uuid]);

        $response = $this->_plivo->calls->startRecording($uuid);

        Log::info([
            'Record'   => 'This is from record inbound record',
            'Response' => $response,
            'CallUUID' => $this->_request->input('CallUUID'),
            'Request'  => $this->_request->all(),
        ]);
    }

请求正在回馈正确的调用uuid ,并且

$response = $this->_plivo->calls->startRecording($uuid);

是文档中使用的代码。有谁知道我在这里做错了什么?

1 个答案:

答案 0 :(得分:0)

Plivo销售工程师。

这是对您的Plivo号码的来电吗?我看到你正在返回一个包含Play和Record元素的XML。 Play结束后,此记录XML将负责记录呼叫。

您是否正在制作Record API请求以再次录制此内容?您传递给此API请求的是哪个Call UUID?

对于入站呼叫,将呼叫UUID发送到应答URL。你在使用这个Call UUID吗?