|
|
|
|
@ -49,6 +49,12 @@ public class OperationSetTelephonyConferencingJabberImpl
|
|
|
|
|
private static final Logger logger
|
|
|
|
|
= Logger.getLogger(OperationSetTelephonyConferencingJabberImpl.class);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The minimum interval in milliseconds between COINs sent to a single
|
|
|
|
|
* <tt>CallPeer</tt>.
|
|
|
|
|
*/
|
|
|
|
|
private static final int COIN_MIN_INTERVAL = 200;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Synchronization object.
|
|
|
|
|
*/
|
|
|
|
|
@ -107,7 +113,34 @@ private void notify(CallPeer callPeer)
|
|
|
|
|
if(!(callPeer instanceof CallPeerJabberImpl))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
CallPeerJabberImpl callPeerJabber = (CallPeerJabberImpl)callPeer;
|
|
|
|
|
final CallPeerJabberImpl callPeerJabber = (CallPeerJabberImpl)callPeer;
|
|
|
|
|
|
|
|
|
|
final long timeSinceLastCoin = System.currentTimeMillis()
|
|
|
|
|
- callPeerJabber.getLastConferenceInfoSentTimestamp();
|
|
|
|
|
if (timeSinceLastCoin < COIN_MIN_INTERVAL)
|
|
|
|
|
{
|
|
|
|
|
if (callPeerJabber.isCoinScheduled())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
logger.info("Scheduling to send a COIN to " + callPeerJabber);
|
|
|
|
|
callPeerJabber.setCoinScheduled(true);
|
|
|
|
|
new Thread(new Runnable(){
|
|
|
|
|
@Override
|
|
|
|
|
public void run()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Thread.sleep(1 + COIN_MIN_INTERVAL - timeSinceLastCoin);
|
|
|
|
|
}
|
|
|
|
|
catch (InterruptedException ie) {}
|
|
|
|
|
|
|
|
|
|
OperationSetTelephonyConferencingJabberImpl.this
|
|
|
|
|
.notify(callPeerJabber);
|
|
|
|
|
}
|
|
|
|
|
}).start();
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// check that callPeer supports COIN before sending him a
|
|
|
|
|
// conference-info
|
|
|
|
|
@ -124,6 +157,7 @@ private void notify(CallPeer callPeer)
|
|
|
|
|
ProtocolProviderServiceJabberImpl.URN_XMPP_JINGLE_COIN))
|
|
|
|
|
{
|
|
|
|
|
logger.info(callPeer.getAddress() + " does not support COIN");
|
|
|
|
|
callPeerJabber.setCoinScheduled(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -162,6 +196,7 @@ private void notify(CallPeer callPeer)
|
|
|
|
|
System.currentTimeMillis());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
callPeerJabber.setCoinScheduled(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|