2017-04-06 117 views
0

我需要在拨打电话时将包括音频文件的呼叫记录详细信息保存到数据库。使用recordingStatusCallback将twilio录制文件保存到数据库

这是我的twiML文件。

<Response> 
    <Dial record="record-from-ringing-dual" recordingStatusCallback="https://example.com/record_data.php" action="https://example.com/test.php" callerId="xxxxxxxxxx"> 
      xxxxxxxxxx 
    </Dial> 
</Response> 

我应该在record_data.php文件做保存记录的详细信息到数据库?

任何人都可以帮助我吗?提前致谢。

+0

@ philnash ..我打电话从浏览器到我的手机,并获得记录和列在https://www.twilio.com/console/voice/logs/recordings。我如何通过'recordingStatusCallback'网址访问录制的电话? – Jenz

+0

对,但你有没有尝试过使用PHP来保存文件呢? – philnash

+0

你试过Google吗? – philnash

回答

0

Twilio开发者传道士在这里。

当您收到recordingStatusCallback webhook时,Twilio会发送following parameters in the body of the request

AccountSid   The unique identifier of the Account responsible for this recording. 
CallSid    A unique identifier for the call associated with the recording. This will always refer to the parent leg of a two leg call. 
RecordingSid  The unique identifier for the recording. 
RecordingUrl  The URL of the recorded audio. 
RecordingStatus  The status of the recording. Possible values are: completed. 
RecordingDuration The length of the recording, in seconds. 
RecordingChannels The number of channels in the final recording file as an integer. Possible values are 1, 2. 
RecordingSource  The type of call that created this recording. For recordings initiated when record is set on <Dial>, DialVerb is returned. 

RecordingUrl是在那里你可以存储在自己的服务器上下载录制。

让我知道是否有帮助。

+0

@ philnash ..我刚刚在recordingStatusCallback页面中用print_r($ _ REQUEST)尝试过。但它不打印任何东西。我可以在存储到服务器之前看到数据吗? – Jenz

+0

它什么都没有显示?这是Twilio提出请求的结果吗?您可以尝试将您的recordingStatusCallback URL指向http://requestb.in/并检查结果吗? – philnash

+0

试过了。在那里我得到了记录的细节。 – Jenz