如何解决Twilio-向呼叫者播放录音,将呼叫转接,然后将耳语传递给被呼叫者
我需要创建一个执行以下操作的Twimlbin(或一组Twimlbins):
- 呼叫者拨打电话时,它会播放录音(我拥有托管的MP3文件的URL)
- 将呼叫转接到号码
- 在连接呼叫之前先向被叫方耳语。
任何可以帮助的人都会很棒。
谢谢!
解决方法
In the webhook URL call the callee using following code
conferenceBuilder = new Conference.Builder(fiendlyname);
conferenceBuilder.statusCallback("your domain here/your callback hanndling url");
conferenceBuilder.statusCallbackMethod(HttpMethod.POST);
conferenceBuilder.statusCallbackEvents(Arrays.asList(Event.START,Event.END,Event.JOIN,Event.LEAVE,Event.MUTE,Event.SPEAKER));
say_message = "Whisper message here";
conferenceBuilder.endConferenceOnExit(true);
conferenceBuilder.waitUrl(waitRingTone); //mp3 file URL to play
//record call if you want
Record record = Record.RECORD_FROM_START;
conferenceBuilder.record(record);
voiceResponse = new VoiceResponse.Builder()
.say(new Say.Builder(say_message).voice(Say.Voice.ALICE).build())
.dial(new Dial.Builder().conference(conferenceBuilder.build()).build())
.build().toXml();
return voiceResponse;
Call Using following code :
CallCreator callCreator = new CallCreator(new PhoneNumber(calleeNumber),new PhoneNumber(twilioNumber),new URI(buildConferenceUrl(friendlyName)));
callCreator.setStatusCallback(your domain name here +" url to handle status callback of call");
callCreator.setMethod(HttpMethod.POST);
callCreator.setStatusCallbackEvent(Arrays.asList("initiated","ringing","answered","completed"));
callCreator.setMachineDetection("Enable");
callCreator.create(restClient);
Return voiceresponse to callee in buildconferenceurl method with say verb
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。