0
votes

I'm trying to make a browser to phone number call using twilio voip.

Currently I'm generating a token for the Javascript client like so

account_sid = 'xxx'
auth_token = 'xxx'
capability = Twilio::Util::Capability.new account_sid, auth_token
capability.allow_client_incoming self.email
capability.allow_client_outgoing 'xxx'
capability.generate

I have checked that my account_sid and auth_token are the live account.

'allow_client_outgoing' is set to the twiml application sid.

I have also set the twiml voice request url to my webservice end point, which returns the appropriate xml when tested using curl.

When the browser attempts to make a call, the call is immediately hung up, and my webservice is never hit.

I have also checked twilio for any alerts, but nothing is there.

What could the problem be? I assume it's something to do with the token I am generating, but the code is so simple I can see what could be wrong.

2
Hi! Megan from Twilio. Try token = capability.generate - does that do it? Otherwise what do you see if you console log or check the Twilio App Monitor? - Megan Speir
capability.generate does exactly the same as token = capability.generate - gibo

2 Answers

1
votes

You do have to set the token to token.generate,

capability = Twilio::Util::Capability.new account_sid, auth_token
capability.allow_client_incoming self.email
capability.allow_client_outgoing 'xxx'
capability_token = capability.generate

In my controller I'm rendering json: {token: capability_token}

1
votes

After trying several things, I thought that this line might be the issue capability.allow_client_incoming self.email

Seems that you can't have special characters in the 'allow_client_incoming' string.