Two-way recording with twilio SIP

87 Views Asked by At

I have set-up a SIP Domain on twilio and I've configured with the following TwinML :

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial callerId="{{#e164}}{{From}}{{/e164}}">
    {{#e164}}{{To}}{{/e164}}
  </Dial>
</Response>

I would like to record all inbound and outbound calls coming on this number but it fails.

I have tried this code :

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial callerId="{{#e164}}{{From}}{{/e164}}">
    {{#e164}}{{To}}{{/e164}}
  </Dial>
  
  
  <Dial record="record-from-ringing-dual"
   recordingStatusCallback="https://sample.org/api/1.1/wf/twiliocalllog"
>
 <Number>+339999999</Number>
 </Dial>
</Response>

Can you tell me how can I handle this issue?

(For Inbound calls, I did it with Studio and it works properly, but for outbound calls, I can't find the best way).

1

There are 1 best solutions below

2
philnash On

For the outbound call you need to use the record attribute on the <Dial> that places the call. Like so:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial callerId="{{#e164}}{{From}}{{/e164}}" record="record-from-ringing-dual" recordingStatusCallback="https://sample.org/api/1.1/wf/twiliocalllog">
    {{#e164}}{{To}}{{/e164}}
  </Dial>
</Response>