kapso
kapso

Reputation: 11903

Twilio client error when accepting client calls

I am using twilio client to make & accept calls from a browser. But when I run the accept page, I get a javascript error on the browser -

Uncaught Twilio.Exception: 401: Unable to determine account.

@ line - twilio.js:2683

Here's the code from my controlled thats gets executed when showing the accept call page/view -

def prepare_accept_call    
  # create the twilio capability object
  capability = Twilio::Util::Capability.new TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN

  # guessing this is not needed for accepting calls, but added to see if it fixes my issue and it doesnt :(
  capability.allow_client_outgoing TWILIO_APP_SID

  capability.allow_client_incoming "some-client-identifier"

  # use this token for client JS - Twilio.Device.setup("#{@token}");
  @token = capability.generate
end

NOTE -: I am successfully able to show the make call page, there are no javascript error - when i click the call button I get the flash microphone permission popup. There are no 401. So guessing my key, tokens etc are ok.

Any idea what could be happening here?

Upvotes: 3

Views: 2635

Answers (2)

Vivek
Vivek

Reputation: 621

I also had this error with similar conditions where all my credentials were correct but the Twilio client debugger was spitting out "Application not found 31001" - which is a Twilio client error code by the way. I realized that I had not entered the Voice request url that is in the applications section. Apparently this is a necessary prerequisite to access the Twilio Client service.

I feel they should have been more clear with their message but regardless I solved it by entering a publicly reachable callback url using a SSH tunneler like Localtunnel or free server like Heroku.

Upvotes: 7

Jack Aboutboul
Jack Aboutboul

Reputation: 1

looking at the code it should work, because it looks good. Can you verify where TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN are ultimately being defined? maybe that could have something to do with it?

Upvotes: 0

Related Questions