/** Process the ACK request, forward it to the other leg. */ public void processAck(RequestEvent requestEvent, ServerTransaction serverTransaction) { try { Dialog dialog = serverTransaction.getDialog(); System.out.println("b2bua: got an ACK! "); System.out.println("Dialog State = " + dialog.getState()); Dialog otherDialog = (Dialog) dialog.getApplicationData(); Request request = otherDialog.createAck(otherDialog.getLocalSeqNumber()); otherDialog.sendAck(request); } catch (Exception ex) { ex.printStackTrace(); } }
/** Process the any in dialog request - MESSAGE, BYE, INFO, UPDATE. */ public void processInDialogRequest( RequestEvent requestEvent, ServerTransaction serverTransactionId) { SipProvider sipProvider = (SipProvider) requestEvent.getSource(); Request request = requestEvent.getRequest(); Dialog dialog = requestEvent.getDialog(); System.out.println("local party = " + dialog.getLocalParty()); try { System.out.println("b2bua: got a bye sending OK."); Response response = messageFactory.createResponse(200, request); serverTransactionId.sendResponse(response); System.out.println("Dialog State is " + serverTransactionId.getDialog().getState()); Dialog otherLeg = (Dialog) dialog.getApplicationData(); Request otherBye = otherLeg.createRequest(request.getMethod()); ClientTransaction clientTransaction = sipProvider.getNewClientTransaction(otherBye); clientTransaction.setApplicationData(serverTransactionId); serverTransactionId.setApplicationData(clientTransaction); otherLeg.sendRequest(clientTransaction); } catch (Exception ex) { ex.printStackTrace(); System.exit(0); } }