nattfodd
nattfodd

Reputation: 1890

Twilio WebRTC client to receive incoming call

The question is: is it possible to initiate incoming call to the browser with clientID directly with POST/Accounts/[AccountSid]/Calls API (or in any other way except the one described below)?

The documentations says yes, but when I provide the clientId like that: { "to": "the_user_id" }, I'm getting a very confusing and weird error:

{
"code": 21215,
"message": "Account not authorized to call +843873743. Perhaps you need to enable some international permissions: https://www.twilio.com/console/voice/calls/geo-permissions/low-risk"
}

I have no clue what is that +843873743 number. It seems like internally twilio tries to call it instead of my clientId value I provided.

It works fine, if I provide real phone number (like +1821... etc) - { "to": "+1821..." }. It makes call as expected, it follows instructions under WebHook url I provide.

I also works, if in the TwiML I provide the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Say>Calling WebRTC client</Say>
    <Dial callerId="+38312312312312">
        <Client>the_user_id</Client>
    </Dial>
    <Say>Bye</Say>
</Response>

But the solution above requires that I have to call a real phone first, and then to add a WebRTC client to the conversation. I want to call the WebRTC client first, and then add any other person using TwiML just as usual.

What I do is I'm playing with twilio quickstart js example.

Any ideas? Thanks.

Upvotes: 1

Views: 458

Answers (1)

nattfodd
nattfodd

Reputation: 1890

I've missed the important part of documentation, that can be found here.

What I basically have missed is that when you're calling a WebRTC client, you should prefix the clientID with client: - so the correct request is:

{
  "from": "+1-202-555-0112",
  "to": "client:the_user_id",
  "url": "https://your-server.com/twilio_ml/webhook.xml"
}

So it works like a charm.

Upvotes: 1

Related Questions