简体   繁体   中英

custom message in twilio IVR Call

I want to use custom message in twilio call, I am using call resource as follows

Twilio.init(accsid, acctoken);
                Call call = Call.creator(
                        new PhoneNumber(TO), //to
                        new PhoneNumber(FROM), //from
                        URI.create(twilioIvrCallUrl))
                        .setStatusCallback(callbackUrl)
                        .setStatusCallbackEvent(IvrStatusEvents)
                        .setStatusCallbackMethod(HttpMethod.POST)
                        .create();

I want to play custom message like "Hi username, Hello world" now username here can be custom. I am not expecting any user interaction just play the provided message. I want to pass this message in call. how this can be done using Call resource?

Twilio developer evangelist here.

You have currently set up your application to make a call, then when that call is answered Twilio will make an HTTP request to twilioIvrCallUrl to find out what to do next.

That URL will need to respond with TwiML to tell Twilio what to do, in this case read out your message using <Say> . The URL can point to a dynamic endpoint that takes parameters and then produces the <Say> with the personalisation you require.

So, if you pass the username in the URL as a query parameter, then read it out of parameters when Twilio makes the request, you can construct your dynamic <Say> on the other end.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM