mygzi
mygzi

Reputation: 1333

How to set the From identifier for Twilio Client (VoIP) outgoing calls?

Our application accepts phone calls or VoIP connections via the twilio.js client into our twilio endpoint. Phone calls are logged by caller ID, but VoIP connections all appear as Anonymous in the twilio call log, e.g.:

Date    Direction   From        To  Type    Status      Recording   Duration
XXYY    Incoming    Anonymous   --- Client  Completed   ---         17 min 7 sec
YYZZ    Incoming    Anonymous   --- Client  Completed   ---         17 min 23 sec

Is there a way to set the From field for outgoing (client->twilio) calls? Looked through Twilio.Device.connect as well as the capability token docs and couldn't find any hints.

Upvotes: 5

Views: 1060

Answers (3)

eminescu
eminescu

Reputation: 65

What worked for me was to set the clientName parameter in the OutgoingClientScope capability.

This is a code sample in js:

capability.addScope(
  new ClientCapability.OutgoingClientScope({
    clientName: 'mike',
    applicationSid: 'AP...'
  })
);

None of the other answers worked for me.

Upvotes: 0

mygzi
mygzi

Reputation: 1333

It all ties into the capability token step, in a completely undocumented (and apparently unknown to Twilio themselves) manner.

In order to get the twilio logs to identify the VoIP endpoint that called into a conference, we had to bind the client ID to the allow_client_incoming capability, and make sure the ID was a straight alphanumeric (e.g. dashes in the string prevented the ID from coming through).

In our server side (ruby) token generation step, it looks something like this:

    capability.allow_client_incoming sanitized_client_id

Upvotes: 4

Devin Rader
Devin Rader

Reputation: 10366

Twilio evangelist here.

When Client connects to your TwiML app endpoint, the From parameter that is passed to the Voice Request URL should be the name of the client.

If that Voice Request URL includes the <Dial> verb telling Twilio to make an outbound phone call and bridge it with the Client call, you can set the callerId parameter:

<Dial callerId="+15555555555" />

Hope that helps.

Upvotes: 1

Related Questions