How can we record Twilio outboud call initiating from browser to phone?

92 Views Asked by At

I am using javascript client by Twilio to make calls to any number. But I am not able to find any solution for this.

How do we record an outbound call from browser to a phone, any server-side or client-side solution for this?

I was able to place call successfully using quickstart.js file using below code

document.getElementById('button-call').onclick = function () {

    try {

        if (document.getElementById('CallTo').value != '') {
            var params = {
                To: "+" + document.getElementById('CallTo').value,
                record: 'record-from-ringing-dual'
            };         
            log('Calling ' + params.To + '...');
            console.log('Calling ' + params.To + '...');
            if (device) {
                var outgoingConnection = device.connect(params);
                outgoingConnection.on('ringing', function () {
                    log('Ringing...');
                    document.getElementById('hdnCallIDs').value = outgoingConnection.parameters.CallSid;
                    log(document.getElementById('hdnCallIDs').value);
                });
            }
        } else {
            log('Enter Dialing number...');
        }
    }
    catch (err) {
        log(err.message);
    }

};
1

There are 1 best solutions below

0
On BEST ANSWER

You will put the TwiML, for the Dial Verb, to Record the calls returned by the Voice URL of your TwiML Application. You instruct the Twilio clients to use a specific TwiML Application SID when creating their access tokens.

record