1
votes

I am using Twilio api for developing a video calling web app. Web app is responsive and can be used on mobile device to make video calls. But when I open my web page on mobile device browser it is not using loudspeaker by default. As per Twilio API Doc we can use Twilio.Device object to set loudspeaker as default. I am stucked on below code, where it is throwing exception followed by the code.

Twilio.Device.setup(token)

Uncaught TypeError: Cannot read property 'length' of undefined
    at twilio.min.js:182
    at Object.objectize (twilio.min.js:179)
    at a.register (twilio.min.js:80)
    at new a (twilio.min.js:76)
    at Function.setup (twilio.min.js:90)
    at Object.success (index.js:159)
    at i (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at A (jquery.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery.min.js:4)

Twilio team please help ...

1

1 Answers

1
votes

This help page did it for me: https://www.twilio.com/docs/tutorials/browser-calls-csharp-mvc#make-a-dashboard-for-our-support-agents

Where I was using Claims before, it was scopes that got it working

var scopes = new HashSet<IScope>
{
    new IncomingClientScope(identity),
    new OutgoingClientScope(appSid)
};
var capability = new Twilio.Jwt.ClientCapability(accountSid, authToken, scopes: scopes);
var token = capability.ToJwt();

I was using this before, capability.Claims.Add("allow_client_outgoing", appSid); capability.Claims.Add("allow_client_incoming", identity);

My code is for allowing incoming and outgoing voice calls. But its likely similar for your video calls.