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 pathDialSample3.java
More file actions
63 lines (49 loc) · 1.79 KB
/
DialSample3.java
File metadata and controls
63 lines (49 loc) · 1.79 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
package samples;
import java.net.URI;
import java.net.URISyntaxException;
import javax.media.mscontrol.join.Joinable;
import com.rayo.client.XmppException;
import com.rayo.core.verb.VerbRef;
import com.rayo.core.DialCommand;
import com.rayo.core.JoinCommand;
import com.rayo.core.JoinDestinationType;
import com.voxeo.moho.Participant.JoinType;
public class DialSample3 extends BaseSample {
public void run() throws Exception {
String callId = client.waitForOffer().getCallId();
client.answer(callId);
VerbRef dial1Ref = dial(callId, "sip:mpermar@iptel.org", JoinType.BRIDGE, callId);
//VerbRef dial2Ref = dial(callId, "sip:mperez@127.0.0.1:3060", JoinType.DIRECT, dial1Ref.getVerbId());
Thread.sleep(6000);
client.unjoin(dial1Ref.getVerbId(), JoinDestinationType.CALL, callId);
//client.unjoin(dial2Ref.getVerbId(), JoinDestinationType.CALL);
Thread.sleep(6000);
client.hangup(callId);
}
private VerbRef dial(String callId, String endpoint, JoinType type, String id) throws URISyntaxException,XmppException {
DialCommand dial = new DialCommand();
dial.setTo(new URI(endpoint));
//dial.setTo(new URI("sip:192.168.1.34:5060"));
JoinCommand join = new JoinCommand();
join.setDirection(Joinable.Direction.DUPLEX);
join.setMedia(type);
join.setTo(id);
join.setType(JoinDestinationType.CALL);
dial.setJoin(join);
try {
dial.setFrom(new URI("sip:user100@127.0.0.1:5060"));
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
VerbRef dialRef = client.dial(dial);
client.waitFor("answered");
return dialRef;
}
public static void main(String[] args) throws Exception {
DialSample3 sample = new DialSample3();
sample.connect("localhost", "user100", "1", "localhost");
sample.run();
sample.shutdown();
}
}