Using the twilio mobile SDK on Android/iOS, to make a voice call to support operators at the backend (purely voip, no phone at either end. Support operators will be using a backend web app that uses the twilio api/twiml to receive and queue calls)
We have one very important requirement -- to be able to pass the user-id from the mobile app to the backend when placing the call. This is required for the backend web-app to be able to automatically pull up the user's information for the support operator who picks up the call in-browser.
Is this possible with the mobile SDK by any method? Any insight would be appreciated
Edit: Can I perhaps use this user-id as the callerid parameter when dialling, and have it read at the web-app side?
After a day of working with Twilio functions, I came up with the following solution.
Mobile app gets access token, hits the Twilio voice endpoint, is routed to the queue, wait music plays etc.
Operator (web app) gets access token, hits the Twilio voice endpoint, and automatically dequeues the first caller from the queue (i.e is connected to them)
In the TwiML for the operator dequeuing, there is a parameter url
which is a TwiML URL that will be fetched and executed on the queued caller's end before the caller is connected to the operator. Twilio passes a bunch of parameters to this URL, including the caller identity and the operator's call sid
We will host this URL at our backend, and store a map of {caller identity, operator call sid}.
The operator web app will poll the backend once the operator dials, until the caller identity corresponding to the current operator call sid is returned. Or the backend can send some kind of push notification to the operator web app. This is up to the implementation (we will use websockets)
For more info please see https://www.twilio.com/docs/voice/twiml/queue
Edit - Twilio javascript API 1.5 supports access tokens instead of capability tokens, so it is simpler to use them for both mobile app and web app.
Edit 2 - Tested this flow today and works fine :-)