0

I am trying to use Twilio Javascript Client to connect Incoming Calls to my Browser using WebRTC. The client is up and in ready state - with a proper capability token.

On the other hand, when I try to dial an outbound call with a TwiML script (to reply to an incoming call) the Outbound Call fails with a "failed" status and no additional information.

I have tried debugging the client, to see if the call is even landing to the Browser - but haven't had any success.

val say = Say
                .Builder("Welcome, please wait will call is connected")
                .language(Say.Language.EN_IN)
                .build()

        val client = Client.Builder("devansh.jain").build()
        val dial = Dial.Builder().client(client).build()
        val voiceResponse = VoiceResponse
                .Builder()
                .say(say)
                .dial(dial)
                .build()

        return voiceResponse.toXml()

The call is supposed to be connected to the browser. But the same is not happening. I am in India and the client is connected to the Singapore Region

Devansh Jain
  • 13
  • 1
  • 1
  • 3
  • I added debugger mode to the Client and got the following error. ` {code: 31100, message: "Invalid application SID", twilioError: Error at new ConnectionError (http://localhost:7060/static/js/bundle.js:174033:32) at PStre…} ` Where does Application SID go? – Devansh Jain Oct 06 '19 at 13:58
  • The application SID should be set in the access token. Can you share the code for that? – philnash Oct 08 '19 at 00:28

1 Answers1

0

I added Outgoing Scope with the IncomingScope in the client and it started working.

val incomingScope = IncomingClientScope(agentId)
val outboundScope = OutgoingClientScope.Builder(TWIML_APP_SID).build()
return capabilityBuilder
    .scopes(listOf(incomingScope, outboundScope))
    .build()
    .toJwt()
Devansh Jain
  • 13
  • 1
  • 1
  • 3