我需要创建一个执行以下操作的Twimlbin(或一组Twimlbins):
任何可以帮助的人都会很棒。
谢谢!
答案 0 :(得分:0)
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