Add a bot into Twilio conference, and announce some information, using conference Friendly name

半腔热情 提交于 2019-12-13 03:36:27

问题


With below code my users are joining a conference call, conference is created with unique names.

const VoiceResponse = require('twilio').twiml.VoiceResponse;
const response = new VoiceResponse();
const dial = response.dial();
dial.conference({
    statusCallback: <event_url>,
    statusCallbackEvent: 'start end join leave'
}, "test_conference_name");

res.type('text/xml');
res.send(response.toString());

Now I want to add bot to this conference call and announce something to all users, like conference is going to end in next 5 min.

const twilio_client = require('twilio')(accountSid, authToken);

twilio_client.calls.create({
    url: "<twiml url with voice responce>",
    to: "test_conference_name",
    from: "+17016390587",
})
.then((call) => {
    console.log("success")
})

I am getting error that The phone number you are attempting to call, "test_conference_name", is not valid.

I saw this solution in this post Twilio: programmatically join conference and play <Say> command or <Play> sound file? but it has old syntax and working with a conference no.

I wan to add a bot on the basis of conference name, I don't have conference no.


回答1:


Twilio developer evangelist here.

Right now, you have two options. However, they both require a number to be connected.

You can either setup a number that points to a URL that returns TwiML to direct your bot into the conference and you call that number with your bot (as the solution from the question you linked).

Or, you create a call from your conference to a number that is connected to your bot which has an inbound webhook that points to the TwiML for the message it's going to say to your conference.

Finally, Conference is getting more features at the moment and the ability to <Say> or <Play> something to your participants is coming soon, according to this blog post.

Let me know if that helps at all.



来源:https://stackoverflow.com/questions/47595208/add-a-bot-into-twilio-conference-and-announce-some-information-using-conferenc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!