1

I am getting an error that i dont understand an cannot find any helpfull informations about:

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https:*******' is therefore not allowed access. The response had HTTP status code 401.

function RecordTheCall()
        {
            var key = '*******************';

            $.get( "https://api.plivo.com/v1/Account/"+key+"/Call/?status=live", function( data ) {                 
              var callUuid = data.call_uuid
            });

            $.ajax({
                url: "https://api.plivo.com/v1/Account/"+key+"/Call/"+callUuid+"/Record/",
                type: "POST",
                data: { 'auth_id': auth_id, 'call_uuid': CallUUID },
                dataType: "json",
                success: function (res) {
                    alert(res);
                },
                error: function(err) {
                    alert(err);
                }
            });
        }
jhon dano
  • 660
  • 6
  • 23

1 Answers1

1

Call recording cannot be accomplished from the Web SDK directly. You cannot use the Plivo API from your Web browser using Javascript because cross-domain ajax requests are not allowed in browsers for security reasons. This has been explained in this Wikipedia article. There are some work arounds to overcome this, but it is browser dependent and hence it might not work always. Instead you should use the Plivo XML/API in you application.

Ramya Raghu
  • 409
  • 3
  • 4
  • how can i get the call_uuid from the websdk! – jhon dano May 26 '15 at 07:18
  • The call_uuid will be sent to your answer url when the call is answered. If you need this uuid on your web sdk, you need to store the call uuid from your answer url in your server, which when requested using an ajax request can return the required details to your java script. If you have any further trouble using Plivo API, you can contact their Customer Support at support@plivo.com – Ramya Raghu May 26 '15 at 11:13
  • I wished they woul reply fast enough to my support Tickets am now waiting for over 1 week for an answer :-) Thanks anyway! – jhon dano May 26 '15 at 15:13