Reputation: 101
When we receive a call, we play a prompt to the caller that says something along the lines of "we may record the call for quality and training purposes".
The TWiML we send in response to the incoming call is the following.
<Response>
<Play>http://domain.tld/may_record_call.wav</Play>
<Dial timeout="10" callerId="5555551234" record="record-from-ringing" action="https://my_url.com/action" method="POST">
<Client>my_user</Client>
</Dial>
</Response>
Our recording is created properly, but it does not include the prompt before the call is placed.
We would like proof that we properly played the prompt, and ideally it would be included in the recording we make, but the dial recording options do not seem to allow this.
record
The 'record' attribute lets you record both legs of a call within the associated verb. When using record-from-answer, the recording will begin when a call is answered. When using record-from ringing, the recording will begin when the ringing starts. In both cases, a RecordingUrl parameter will be sent to the 'action' URL on the associated verb. You must set an 'action' URL to receive the RecordingUrl.
I can't add the play after the dial, because when the call is answered, further verbs after the dial are not executed.
My question is how do I record my call recording warning as part of my call recording? Is there another hidden record value that can be used? Is there a way to get the dial to start, but play the prompt to caller?
Upvotes: 10
Views: 2630
Reputation: 10048
An option would be to have 2 Twilio numbers. Original number and a second one which records and redirects calls when call is answered.
redirect.xml
<Response>
<Dial timeout="10" record="record-from-ringing">
<Number>+164666XXXX</Number>
</Dial>
</Response>
The first number Voice URL points to redirect.xml The second Twilio (original) number 164666XXXX Voice URL is configured using recording.xml
<Response>
<Play>http://domain.tld/may_record_call.wav</Play>
<Dial timeout="10" action="https://my_url.com/action" method="POST">
<Client>my_user</Client>
</Dial>
</Response>
The recording will appear under first number. This involves extra cost but is a workaround which I successfully tested.
Upvotes: 0
Reputation: 652
If this is an outbound call, in your API request include the optional POST parameter Record=true
. This will record the entirety of a phone call, including the <Play>
and <Dial>
tags. The RecordingUrl
will be sent to the StatusCallback
URL. You will then probably want to remove the record
parameter from <Dial>
tag, or you'll end up with two recordings of the conversation.
You can read more about recording calls this way in the API documentation.
You can learn more about the various ways Twilio records calls in Twilio Skills Training.
Upvotes: 0