private void sendRegisterSuccessResponse(int resultCode, List<RegistrationBinding> bindings, ServerTransaction serverTransaction) throws ParseException, SipException, InvalidArgumentException { List<?> contactHeaders = getContactHeaders(bindings); Response res = (this.messageFactory.createResponse(resultCode, serverTransaction.getRequest())); if ((contactHeaders != null) && (!contactHeaders.isEmpty())) { if (this.tracer.isFineEnabled()) { this.tracer .fine("Adding " + contactHeaders.size() + " headers"); } for (int i = 0; i < contactHeaders.size(); i++) { ContactHeader hdr = (ContactHeader) contactHeaders.get(i); res.addHeader(hdr); } } DateHeader dateHeader = this.headerFactory .createDateHeader(new GregorianCalendar()); res.setHeader(dateHeader); serverTransaction.sendResponse(res); }
private void sendErrorResponse(int resultCode, ServerTransaction serverTransaction) throws ParseException, SipException, InvalidArgumentException { Response response = this.messageFactory.createResponse(resultCode, serverTransaction.getRequest()); if (resultCode == Response.INTERVAL_TOO_BRIEF) { response.setHeader(this.headerFactory .createDateHeader(new GregorianCalendar())); // set min expires header response.addHeader(this.headerFactory.createHeader("Min-Expires", Long.toString(config.getSipRegistrationMinExpires()))); } serverTransaction.sendResponse(response); }
private void initialSipSessionSetup(RequestEvent event, ActivityContextInterface aci) throws ParseException, SipException, InvalidArgumentException { // store the server tx aci in a cmp shortcut setServerTransactionACI(aci); // send trying response ServerTransaction serverTransaction = event.getServerTransaction(); Response response = sipRaSbbInterface .getMessageFactory() .createResponse(Response.TRYING, serverTransaction.getRequest()); serverTransaction.sendResponse(response); // create sip dialog and attach to its activity Dialog dialog = sipRaSbbInterface.getNewDialog(serverTransaction); ActivityContextInterface dialogAci = sipRaAciFactory .getActivityContextInterface((DialogActivity) dialog); dialogAci.attach(sbbContext.getSbbLocalObject()); // store the dialog aci in a cmp shortcut setDialogACI(dialogAci); }
private void initialSipSessionSetup(RequestEvent event, ActivityContextInterface aci) throws ParseException, SipException, InvalidArgumentException { // store the server tx aci in a cmp shortcut setServerTransactionACI(aci); // send trying response ServerTransaction serverTransaction = event.getServerTransaction(); Response response = sipRaSbbInterface .getMessageFactory() .createResponse(Response.TRYING, serverTransaction.getRequest()); serverTransaction.sendResponse(response); // create sip dialog and attach to its activity Dialog dialog = sipRaSbbInterface.getNewDialog(serverTransaction); ActivityContextInterface dialogAci = sipRaAciFactory .getActivityContextInterface((DialogActivity) dialog); dialogAci.attach(sbbContext.getSbbLocalObject()); // store the dialog aci in a cmp shortcut setDialogACI(dialogAci); }
&& transaction.getDialog() == null && JainSipUtils.DIALOG_CREATING_METHODS.contains(getMethod())) { final String transport = JainSipUtils.findTransport(transaction.getRequest()); final SipProvider sipProvider = sipFactoryImpl.getSipNetworkInterfaceManager().findMatchingListeningPoint( transport, false).getSipProvider();
} else { ServerTransaction txn = getServerTransaction(); Request request = txn.getRequest();
private void abortSipSessionSetup() { SbbLocalObject sbbLocalObject = sbbContext.getSbbLocalObject(); ActivityContextInterface dialogACI = getDialogACI(); if (dialogACI != null) { dialogACI.detach(sbbLocalObject); try { Dialog dialog = (Dialog) dialogACI.getActivity(); dialog.delete(); } catch (Exception e) { tracer.severe("failed to abort sip dialog.", e); } } ActivityContextInterface serverTransactionACI = getServerTransactionACI(); if (serverTransactionACI != null) { serverTransactionACI.detach(sbbLocalObject); ServerTransaction serverTransaction = (ServerTransaction) serverTransactionACI .getActivity(); try { Response response = sipRaSbbInterface.getMessageFactory() .createResponse(Response.SERVER_INTERNAL_ERROR, serverTransaction.getRequest()); serverTransaction.sendResponse(response); } catch (Exception e) { tracer.severe("failed to abort sip server tx.", e); } } }
private void abortSipSessionSetup() { SbbLocalObject sbbLocalObject = sbbContext.getSbbLocalObject(); ActivityContextInterface dialogACI = getDialogACI(); if (dialogACI != null) { dialogACI.detach(sbbLocalObject); try { Dialog dialog = (Dialog) dialogACI.getActivity(); dialog.delete(); } catch (Exception e) { tracer.severe("failed to abort sip dialog.", e); } } ActivityContextInterface serverTransactionACI = getServerTransactionACI(); if (serverTransactionACI != null) { serverTransactionACI.detach(sbbLocalObject); ServerTransaction serverTransaction = (ServerTransaction) serverTransactionACI .getActivity(); try { Response response = sipRaSbbInterface.getMessageFactory() .createResponse(Response.SERVER_INTERNAL_ERROR, serverTransaction.getRequest()); serverTransaction.sendResponse(response); } catch (Exception e) { tracer.severe("failed to abort sip server tx.", e); } } }
private void finishSipSessionSetup(byte[] sdp) throws ParseException, SipException, InvalidArgumentException { ServerTransaction serverTransaction = (ServerTransaction) getServerTransactionACI() .getActivity(); ContentTypeHeader contentType = sipRaSbbInterface.getHeaderFactory() .createContentTypeHeader("application", "sdp"); String localAddress = sipRaSbbInterface.getListeningPoints()[0] .getIPAddress(); int localPort = sipRaSbbInterface.getListeningPoints()[0].getPort(); Address contactAddress = sipRaSbbInterface.getAddressFactory() .createAddress("sip:" + localAddress + ":" + localPort); ContactHeader contact = sipRaSbbInterface.getHeaderFactory() .createContactHeader(contactAddress); Response ok = sipRaSbbInterface.getMessageFactory().createResponse( Response.OK, serverTransaction.getRequest(), contentType, sdp); ok.setHeader(contact); serverTransaction.sendResponse(ok); }
private void finishSipSessionSetup(byte[] sdp) throws ParseException, SipException, InvalidArgumentException { ServerTransaction serverTransaction = (ServerTransaction) getServerTransactionACI() .getActivity(); ContentTypeHeader contentType = sipRaSbbInterface.getHeaderFactory() .createContentTypeHeader("application", "sdp"); String localAddress = sipRaSbbInterface.getListeningPoints()[0] .getIPAddress(); int localPort = sipRaSbbInterface.getListeningPoints()[0].getPort(); Address contactAddress = sipRaSbbInterface.getAddressFactory() .createAddress("sip:" + localAddress + ":" + localPort); ContactHeader contact = sipRaSbbInterface.getHeaderFactory() .createContactHeader(contactAddress); Response ok = sipRaSbbInterface.getMessageFactory().createResponse( Response.OK, serverTransaction.getRequest(), contentType, sdp); ok.setHeader(contact); serverTransaction.sendResponse(ok); }
private void initialMediaSessionSetup(ServerTransaction serverTransaction) throws MsControlException { // create media session MediaSession session = msRaSbbInterface.createMediaSession(); ActivityContextInterface mediaSessionACI = mscRaAciFactory .getActivityContextInterface(session); SbbLocalObject sbbLocalObject = sbbContext.getSbbLocalObject(); mediaSessionACI.attach(sbbLocalObject); // store the media session aci in a cmp shortcut setMediaSessionACI(mediaSessionACI); tracer.info("Created media session: " + session); // create network connection NetworkConnection connection = session .createNetworkConnection(NetworkConnection.BASIC); ActivityContextInterface connectionACI = mscRaAciFactory .getActivityContextInterface(connection); connectionACI.attach(sbbLocalObject); // store the network connection aci in a cmp shortcut setNetworkConnectionACI(connectionACI); tracer.info("Created network connection: " + connection); // process the received sdp SdpPortManager sdpManager = connection.getSdpPortManager(); tracer.info("Created SDP Manager, sending client sdp..."); sdpManager.processSdpOffer((byte[]) serverTransaction.getRequest() .getContent()); }
private void initialMediaSessionSetup(ServerTransaction serverTransaction) throws MsControlException { // create media session MediaSession session = msRaSbbInterface.createMediaSession(); ActivityContextInterface mediaSessionACI = mscRaAciFactory .getActivityContextInterface(session); SbbLocalObject sbbLocalObject = sbbContext.getSbbLocalObject(); mediaSessionACI.attach(sbbLocalObject); // store the media session aci in a cmp shortcut setMediaSessionACI(mediaSessionACI); tracer.info("Created media session: " + session); // create network connection NetworkConnection connection = session .createNetworkConnection(NetworkConnection.BASIC); ActivityContextInterface connectionACI = mscRaAciFactory .getActivityContextInterface(connection); connectionACI.attach(sbbLocalObject); // store the network connection aci in a cmp shortcut setNetworkConnectionACI(connectionACI); tracer.info("Created network connection: " + connection); // process the received sdp SdpPortManager sdpManager = connection.getSdpPortManager(); tracer.info("Created SDP Manager, sending client sdp..."); sdpManager.processSdpOffer((byte[]) serverTransaction.getRequest() .getContent()); }
Response response = messageFactory.createResponse(Response.OK,serverTransaction.getRequest()); response.addHeader(getContactHeader()); serverTransaction.sendResponse(response);
Request request = txn.getRequest();
Request request = txn.getRequest();
Request request = txn.getRequest();