{
sid = Math.abs(random.nextLong());
InfoQuery query = RTPBridge.getRTPBridge(connection, String.valueOf(sid));
connection.send(query, new IQResultListener()
{
public void iqResult(InfoQuery iq)
{
try {
String localIp;
int network;
if (iceNegociator.getPublicCandidate() != null) {
localIp = iceNegociator.getPublicCandidate().getBase().getAddress().getInetAddress().getHostAddress();
network = iceNegociator.getPublicCandidate().getNetwork();
}
else {
localIp = BridgedResolver.getLocalHost();
network = 0;
}
RTPBridge rtpBridge = (RTPBridge) iq.getIQExtension();
TransportCandidate localCandidate = new ICECandidate(
rtpBridge.getIp(), 1, network, String.valueOf(Math.abs(random.nextLong())), rtpBridge.getPortA(), "1", 0, ICECandidate.Type.relay);
localCandidate.setLocalIp(localIp);
TransportCandidate remoteCandidate = new ICECandidate(
rtpBridge.getIp(), 1, network, String.valueOf(Math.abs(random.nextLong())), rtpBridge.getPortB(), "1", 0, ICECandidate.Type.relay);
remoteCandidate.setLocalIp(localIp);
localCandidate.setSymmetric(remoteCandidate);
remoteCandidate.setSymmetric(localCandidate);
localCandidate.setPassword(rtpBridge.getPass());
remoteCandidate.setPassword(rtpBridge.getPass());
localCandidate.setSessionId(rtpBridge.getSid());
remoteCandidate.setSessionId(rtpBridge.getSid());
localCandidate.setConnection(connection);
remoteCandidate.setConnection(connection);
addCandidate(localCandidate);
}
catch (UtilityException e) {
e.printStackTrace();
}
catch (UnknownHostException e) {
e.printStackTrace();
}
}
},10);
// Get Public Candidate From XMPP Server
if (iceNegociator.getPublicCandidate() == null) {
connection.send(RTPBridge.getPublicIP(connection),new IQResultListener()
{
public void iqResult(InfoQuery iq)
{
RTPBridge response = (RTPBridge) iq.getIQExtension();