使用recordingStatusCallback将twilio录音保存到数据库

时间:2017-04-06 12:10:25

标签: php twilio twilio-api twilio-php

我需要在拨打电话时将包括音频文件在内的通话记录详细信息保存到数据库中。

这是我的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 文件中将记录的详细信息保存到数据库中?

任何人都可以帮我这个吗?提前谢谢。

1 个答案:

答案 0 :(得分: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是您可以在自己的服务器上下载录音的地方。

如果有帮助,请告诉我。