public void testCallForwardingCallerSendBye() throws Exception { sender = new TestSipListener(5080, 5070, senderProtocolObjects, false); SipProvider senderProvider = sender.createProvider(); receiver = new TestSipListener(5090, 5070, receiverProtocolObjects, false); receiver.setSendReinvite(true); SipProvider receiverProvider = receiver.createProvider(); receiverProvider.addSipListener(receiver); senderProvider.addSipListener(sender); senderProtocolObjects.start(); receiverProtocolObjects.start(); String fromName = "forward-sender"; String fromSipAddress = "sip-servlets.com"; SipURI fromAddress = senderProtocolObjects.addressFactory.createSipURI(fromName, fromSipAddress); String toSipAddress = "sip-servlets.com"; String toUser = "******"; SipURI toAddress = senderProtocolObjects.addressFactory.createSipURI(toUser, toSipAddress); sender.sendSipRequest("INVITE", fromAddress, toAddress, null, null, false); Thread.sleep(TIMEOUT); assertTrue(sender.isInviteReceived()); assertTrue(sender.isAckReceived()); assertNotNull(sender.getInviteRequest().getHeader("ReInvite")); MaxForwardsHeader maxForwardsHeader = (MaxForwardsHeader) receiver.getInviteRequest().getHeader(MaxForwardsHeader.NAME); assertNotNull(maxForwardsHeader); // Non Regression test for http://code.google.com/p/mobicents/issues/detail?id=1490 // B2buaHelper.createRequest does not decrement Max-forwards assertEquals(69, maxForwardsHeader.getMaxForwards()); sender.sendInDialogSipRequest("BYE", null, null, null, null, null); Thread.sleep(TIMEOUT); assertTrue(receiver.getByeReceived()); assertTrue(sender.getOkToByeReceived()); assertEquals(1, sender.bindings); // http://code.google.com/p/mobicents/issues/detail?id=2100 maxForwardsHeader = (MaxForwardsHeader) receiver.getByeRequestReceived().getHeader(MaxForwardsHeader.NAME); assertNotNull(maxForwardsHeader); // Non Regression test for http://code.google.com/p/mobicents/issues/detail?id=1490 // B2buaHelper.createRequest does not decrement Max-forwards assertEquals(69, maxForwardsHeader.getMaxForwards()); }
public void testReInviteSending() throws InterruptedException, SipException, ParseException, InvalidArgumentException { String fromName = "isendreinvite"; String fromSipAddress = "sip-servlets.com"; SipURI fromAddress = senderProtocolObjects.addressFactory.createSipURI(fromName, fromSipAddress); String toUser = "******"; String toSipAddress = "sip-servlets.com"; SipURI toAddress = senderProtocolObjects.addressFactory.createSipURI(toUser, toSipAddress); sender.setSendReinvite(true); sender.setSendBye(true); sender.sendSipRequest("INVITE", fromAddress, toAddress, null, null, false); Thread.sleep(TIMEOUT); assertTrue(sender.getOkToByeReceived()); }