ThinkFloyd
ThinkFloyd

Reputation: 5021

How to get Twilio conference name in client after it joins the conference?

I have scenario where conference is started when customer calls a number and then a call is made to agent's browser's client with url of TwiML which has instructions to dial to conference's name. After Agent browser connects to the conf call and starts talking to customer, it tries to add another agent to the same conference to help him out. At this point I have second agent's client name but how do I get friendly name of conference to which the agent is connected now?

One option which I am trying is to have some naming convention to conf names so that I can search for conferences with that kind of name and then use it to ask second agent to join but this is not deterministic approach.

Another option can be to look at device connection object to find out call sid and the search for all in-progress calls in my account and look for all the participants and match their call sid. This also is overkill.

Isn't there a quick way to get conference details using call sid of the participant?

Upvotes: 0

Views: 532

Answers (1)

Devin Rader
Devin Rader

Reputation: 10366

Twilio evangelist here.

In the past I've gone the naming convention route, using the CallSid of the first caller into the conference as the conference room name.

That way, as long as I know that sid I can generate the TwiML needed to let another caller join without having to look anything up through the Twilio API.

Instead, when I make the request to dial the second agent, I just append that sid to the URL I give Twilio:

client.makeCall({
    to: 'client:sallySecondAgent',
    from: config.twilioNumber,
    url: "http://example.com/addAgent?confName=[sid]"
}

Then in the addAgent route I can generate the <Dial> using that confName parameter:

var twiml = new twilio.TwimlResponse();
twiml.dial(function(dialNode) {
  dialNode.conference(request.query.confName);
});
response.type('text/xml');
response.send(twiml.toString());

Hope that helps.

Upvotes: 1

Related Questions