Ring Out API Endpoint returns - { "message" : "Unsupported Media Type", "errors" : [ ] }

  • 1
  • Problem
  • Updated 3 months ago
I have tried many times to make a Ring Out call from my web application that I am building that has its own little dialpad. I have made sure that the Outbound caller ID setting is not blocked for the RingOut from web setting. I am completely able to make a ringOut phone call using the API explorer, but I feel like I just might be missing some headers, or some wierd quirk that the documentation does not describe anywhere. And trust me I have looked all over the place. Either way, Here is an example request that I am making using Node.js to start the phone call.

router.post("/make/ring/out", function (req, res, next) {
    var access = req.body.access;
    var callInfo = req.body.callInfo;
    var option = {
        method: 'POST',
        url: 'https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/ring-out',
        headers: {
            'Cache-Control': 'no-cache',
            'Authorization': 'Bearer ' + access,
        },
        form: {
            callerId: {
                phoneNumber: callInfo.callId
            },
            to: {
                phoneNumber: callInfo.phone1
            },
            from: {
                phoneNumber: callInfo.from
            },
            playPrompt: true,
            country: {id: "1"}
        }
    };
    request(option, function (error, response, body) {
        if (error) throw new Error(error);
        var bod = JSON.parse(body);
            res.send(bod);
            res.end();
        } else {
            res.send(bod);
            res.end();
        }
    });
});

with this setup, I always get the error that I described in the title. 

{
  "message" : "Unsupported Media Type",
  "errors" : [ ]
}
I also have the ringcentral softphone open and loaded into the same account that I have the access token for. I havent ever been able to make a successful ringOut call. So any help would be supremely appreciated!

Thanks in advance!
Photo of Jameson Bevans

Jameson Bevans

  • 180 Points 100 badge 2x thumb
  • tired and frustrated

Posted 3 months ago

  • 1
Photo of Phong Vu

Phong Vu, Devangelist

  • 3,192 Points 3k badge 2x thumb
Hi Jameson,

Is there any particular reason why you don't want to use our Node JS SDK? It is a very convenient tool we made for developers to access RingCentral platform and call APIs.

See the "Making telephony calls" section on the README file for code snippet. Remember to use the new endpoint "ring-out" instead of "ringout"

Let me know,
+ Phong


(Edited)