Closed cin210 closed 3 years ago
I also experienced this issue. This library only propagates to Twilio certain params (don't remember which atm). The issue here is how 'correct' is for twilio the use of custom parameters. If twilio says it's okay, this library should propagate all the custom parameters to the twilio android sdk (Don't know how this issue affects iOS)
I'd happily open a PR in that case :D
This older article flatly states the mobile client cannot pass custom params, but this twilio API doc instructs you how to do so on android.
I believe it is correct behavior in the sense that Twilio has guides encouraging it and supports it in their other APIs like the Web javascript client
I work on the Programmable Voice SDKs and can provide some guidance on this issue.
Passing custom parameters from the Android or iOS SDK to the server application is supported. However, propagating these custom parameters into the Twilio helper library to another client from your server code is not (this is a feature that has been requested and is in our backlog). If your server application requires additional context you are welcome to add custom parameters.
I would recommend either removing the validation and passing the params "as-is" in this method or using a flag to opt-out of this validation when needed. https://github.com/hoxfon/react-native-twilio-programmable-voice/blob/master/android/src/main/java/com/hoxfon/react/RNTwilioVoice/TwilioVoiceModule.java#L621-L650
Thanks @idelgado to jump in! Can you confirm that my understanding of your explanation is correct:
Considering the following SDK method call:
Voice.call(getReactApplicationContext(), accessToken, twiMLParams, callListener);
Could twiMLParams
be a Map
containing any arbitrary number of strings?
If so we could iterate over the Javascript object passed and convert it into a Java Map - which is strongly typed - omitting any key containing non string values.
I also experienced this issue. And made an pull request based on @idelgado 's suggestion.
https://github.com/hoxfon/react-native-twilio-programmable-voice/pull/94
This has been resolved in #94, closing this issue
Using:
Step to reproduce:
Output:
In Twilio:
Extra parameters are logged in Android when the call begins, and the call is connected successfully, but when inspecting the call in Twilio, the extra parameters are not present and they are never passed along to my server that handles the Twiml.
Some params I am trying to pass along are additional user and device meta data (example: version and model of the android device, as well as some app-specific account identifiers). Some of these params are required for determining how to handle the call at the server level, all while using the same dedicated Twiml App route.
It looks like the _callParams hash is serialized in the connect method, but it is not surviving the journey from client to Twiml to my server. Anything I am doing wrong here? Previously I was using the same Twiml App with the same params and https://www.npmjs.com/package/react-native-twilio but I waned to migrate because that library is not really maintained.
ApplicationSid and AccountSid are correct, the To field is correct, I can lookup the call by CallSID, but normally I am able to pass additional parameters through Twiml when making outbound calls, but not with this library.
Any advice (twilio-related or otherwise) would be appreciated.