This repository was archived by the owner on May 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMixerSample.java
More file actions
72 lines (53 loc) · 2.31 KB
/
MixerSample.java
File metadata and controls
72 lines (53 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package samples;
import java.util.HashMap;
import java.util.Map;
import javax.media.mscontrol.join.Joinable;
import com.rayo.core.verb.Conference;
import com.rayo.core.verb.Ssml;
import com.rayo.core.JoinCommand;
import com.rayo.core.JoinDestinationType;
import com.voxeo.moho.Participant.JoinType;
public class MixerSample extends BaseSample {
public void run() throws Exception {
connect("localhost", "userc", "1", "localhost");
String firstCall = client.waitForOffer().getCallId();
client.answer(firstCall);
client.say("We are goint to create a conference and then say something to it", firstCall);
Conference conference = buildConference();
client.conference(conference, firstCall);
String secondCall = client.waitForOffer().getCallId();
client.answer(secondCall);
JoinCommand join = buildJoinCommand(conference.getRoomName());
client.command(join, secondCall);
client.say("Oh my god, we are speaking to the conference.Oh my god, we are speaking to the conference.Oh my god, we are speaking to the conference.Oh my god, we are speaking to the conference.", conference.getRoomName());
Thread.sleep(10000);
client.hangup(firstCall);
client.hangup(secondCall);
}
private JoinCommand buildJoinCommand(String conferenceName) {
Map<String, String> headers = new HashMap<String, String>();
headers.put("playTones", "true");
JoinCommand join = new JoinCommand();
join.setTo(conferenceName);
join.setType(JoinDestinationType.MIXER);
join.setDirection(Joinable.Direction.DUPLEX);
join.setMedia(JoinType.BRIDGE);
return join;
}
private Conference buildConference() {
Conference conference = new Conference();
conference.setRoomName("1234");
conference.setModerator(true);
conference.setBeep(false);
Ssml announcementSsml = new Ssml("has joined the conference");
announcementSsml.setVoice("allison");
conference.setAnnouncement(announcementSsml);
Ssml musicSsml = new Ssml("The moderator how not yet joined.. Listen to this awesome music while you wait.<audio src='http://www.yanni.com/music/awesome.mp3' />");
musicSsml.setVoice("herbert");
conference.setHoldMusic(musicSsml);
return conference;
}
public static void main(String[] args) throws Exception {
new MixerSample().run();
}
}