Show friendly from field in CallKit but keep unique client identifier
nxz91 opened this issue · 7 comments
Hello again from Berlin,
When receiving an incoming call, I would like to show a friendly name (e.g. the chosen group name or the first name of the person calling) in CallKit. On the other side, I would like to be able to also get the full caller identifier (a UUID) to be able to know who is actually calling in my client logic.
However, the call object I am getting only contains one from field (client:xyz
) where I can only chose xyz
freely (base64 encoding should work, right?). Is there a recommended strategy for this? I went through all the GitHub issues and didn't find anything.
Thank you!
Leonard
Hi Leonard,
Thanks for the question.
As we don't support custom params in the push notification payload, currently the only value for displaying the caller's name is the from
value of the TVOCallInvite
object, and it does have to comply to some Twilio character limitation, which makes it hard for developers to put arbitrary values.
If the friendly name to be displayed is not more complicated than "John Appleseed", one suggestion to use underscore _
in between and parse in the application logic.
For more complex use cases, we would recommend sending a API request to your server, with the from
value as the request param, and get back a value that meets your application's need.
-bobie
Hi Bobie,
Thanks for the clarification! My first idea was encode a JSON object as base64 in the from field and then decoding it and only passing the friendly
key to reportNewIncomingCallWithUUID, while an id
field is processed internally. The problem is that base64 is not alphanumeric (there are two 3 disallowed characters in there). The alternative I'm looking into is a base32 encoded serialized JSON object (and replacing the =
padding by an underscore).
Just wanted to leave this here.
Thanks for your help =)
(The one negative effect of this being that people cannot call the user back through the Phone app, but that is not working in my case for some reason anyway)
Thanks Leonard! This is good info for us too.
One thing I forgot to ask 😬 : what is the maximum length of the from
field? The link you sent only says alphanumeric and underscore, but nothing about maximum length (https://www.twilio.com/docs/voice/client/capability-tokens) :-)
The funny part is, and we've actually done some experiments with very long names, we don't know the length limit of client ID. The Voice service doesn't seem to have any restrictions as for the length, only the characters allowed are documented.
😀 That's great news! By the way, this is a tremendous support experience. Thanks!!!