Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: can't get custom parameters from Twilio on "deviceDidReceiveIncoming" #181

Open
mevanso01 opened this issue Dec 26, 2020 · 6 comments
Assignees

Comments

@mevanso01
Copy link

mevanso01 commented Dec 26, 2020

Using:

  • React Native: 0.63.2
  • react-native-twilio-programmable-voice 4.3.0
  • Android 10 Samsumg

On "deviceDidReceiveIncoming" event, I expect to get custom parameters from Twilio but I have only 3 parameters: "call_sid", "call_from", "call_to".

This is how the PHP backend sends extra parameters:

$response = new VoiceResponse();
$dial = $response->dial(null, ['callerId'=>"+1$caller"]);
$client = $dial->client();
$client->identity($to);
$client->parameter(array('name' => 'location', 'value' => $location));
$client->parameter(array('name' => 'caller'  , 'value' => $callerMsg));
$client->parameter(array('name' => 'soList'  , 'value' => json_encode($soList)));

And I have a website that receives these parameters correctly.

device.on('incoming', function(connection) {
    console.log('Twilio incoming');
    var customInfo = Helper.MapToObj(connection.customParameters);
    // {
    //     "location": "",
    //     "caller": "",
    //     "soList": ""
    // }
});

Is there a way I can get extra parameters in "deviceDidReceiveIncoming"? Or is this something I need to do in "TwilioVoiceModule.java" file?

@mevanso01
Copy link
Author

Is anyone here to review my issue?

@jdegger
Copy link
Collaborator

jdegger commented Feb 2, 2021

Hi @mevanso01 my apologies for the late reply!

This might be possible with some additional plugin. I will add this a feature request. In essence, we already have it built in but just not passing on the custom parameters to React.

See this PR: https://github.com/hoxfon/react-native-twilio-programmable-voice/pull/170/files

If somebody has time to put in the work and expose the custom params to react then your issue will be solved. Until then I mark this as 'in backlog'.

@mevanso01
Copy link
Author

Hi @jdegger thanks for your reply.

I was able to modify the Android source code of this package for my need and it works well.
mevanso01/rn-gma-twilio-programmable-voice@11e6b2e

@jdegger
Copy link
Collaborator

jdegger commented Feb 2, 2021

@mevanso01 thats great! Would you be willing to PR this? Of course that would also need the iOS work done but that would amazing.

Let me know

@mevanso01
Copy link
Author

@jdegger sure, I will. What're the steps to do that?

By the way, is this possible for iOS? TwilioVoice works through iOS CallKit, so I think sending custom parameters are for Android only. https://support.twilio.com/hc/en-us/articles/115011213347-Passing-Custom-Information-via-Requests-to-Twilio

What do you think?

@jdegger
Copy link
Collaborator

jdegger commented Feb 3, 2021

Hi @mevanso01 I think the solution is in your own URL you posted:

image

callInvite.customParameters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants