prepare test call with rtp

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@16 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
jehan 2008-09-09 19:07:46 +00:00
parent 6eef0d0968
commit 3c8f207d2f
2 changed files with 24 additions and 8 deletions

View file

@ -68,14 +68,15 @@ public class RtpRelayService implements ServiceProvider{
lInputObj = lIn.readObject();
mLog.info("request message ["+lInputObj+"] received");
if (lInputObj instanceof AddressRequest) {
SingleAddressResponse lAddressResponse = new SingleAddressResponse(mConfig.getAudioVideoPublicSocketAddress());
Map<MediaType,InetSocketAddress> lList = new HashMap<MediaType,InetSocketAddress>();
lList.put(MediaType.audio, mConfig.getAudioVideoPublicSocketAddress());
lList.put(MediaType.video, mConfig.getAudioVideoPublicSocketAddress());
AddressResponse lAddressResponse = new AddressResponse(lList);
lOut.writeObject(lAddressResponse);
lOut.flush();
} else {
mLog.error("unknown request ["+lInputObj+"]");
}
lStop = true;
}
} catch (Exception e) {

View file

@ -47,11 +47,9 @@ public class SipClient {
+"s=\n"
+"c=IN IP4 192.0.2.3\n"
+"t=0 0\n"
+"a=ice-pwd:asd88fgpdd777uzjYhagZg\n"
+"a=ice-ufrag:8hhY\n"
+"m=audio 45664 RTP/AVP 0\n"
+"a=rtpmap:0 PCMU/8000\n"
+"a=candidate:1 1 UDP 2130706431 127.0.0.1 8998 typ host";
+"a=relay-session-id:toto";
@ -130,6 +128,14 @@ public class SipClient {
* @param should I put an SDP ?
*/
public void call(String aTo,SipProvider aCalleeProvider,boolean enableSdp) {
call(aTo, aCalleeProvider, enableSdp, 0);
}
/**
* @param aTo uri to call
* @param aProvider sip provider of the To party
* @param should I put an SDP ?
*/
public Call call(String aTo,SipProvider aCalleeProvider,boolean enableSdp,final long aCallDuration) {
try {
String lCallerUri = mSipIdentity;
@ -161,7 +167,15 @@ public class SipClient {
CallListener lCalleeListener = new DefaultCallListener() {
public void onCallConfirmed(Call call, String sdp, Message ack) {
lCalleeSemaphoreConfirmed.release();
call.bye();
if (aCallDuration != Long.MAX_VALUE) {
try {
Thread.sleep(aCallDuration);
} catch (InterruptedException e) {
//nop
}
call.bye();
}
}
public void onCallIncoming(Call call, NameAddress callee, NameAddress caller, String sdp, Message invite) {
lCalleeSemaphoreIncoming.release();
@ -183,12 +197,13 @@ public class SipClient {
Assert.assertTrue("caller call not accepted until ["+lTimout+"]", lCallerSemaphoreAccepted.tryAcquire(lTimout,TimeUnit.MILLISECONDS));
Assert.assertTrue("callee call not confirmed until ["+lTimout+"]", lCalleeSemaphoreConfirmed.tryAcquire(lTimout,TimeUnit.MILLISECONDS));
Assert.assertTrue("caller call not closed until ["+lTimout+"]", lCalleeSemaphoreClosed.tryAcquire(lTimout,TimeUnit.MILLISECONDS));
mLog.info("Call ok");
return lCaller;
} catch (Exception e) {
mLog.error("Call ko",e);
Assert.fail(e.getMessage());
return null;
}