2017-04-06 122 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