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); }
serverTransactionId = provider.getNewServerTransaction(notify); Dialog dialog = serverTransactionId.getDialog(); serverTransactionId.sendResponse(response);
(ServerTransaction) sipServletRequest.getTransaction(); if(cancelTransaction != null && !TransactionState.TERMINATED.equals(cancelTransaction.getState())) { if(logger.isDebugEnabled()) { logger.debug("Sending 200 to Cancel " + sipServletRequest); sipServletRequest.createResponse(200, "Canceling"); Response cancelJsipResponse = (Response) cancelResponse.getMessage(); cancelTransaction.sendResponse(cancelJsipResponse); sipApplicationDispatcher.updateResponseStatistics(cancelJsipResponse, false); } catch (SipException e) { logger.debug("Retransmission received for CANCEL " + sipServletRequest + ", transaction " + cancelTransaction); if(cancelTransaction != null) { logger.debug("Cancel Transaction state " + cancelTransaction.getState());
/** * * @param errorCode * @param transaction * @param request * @param sipProvider */ public static void sendErrorResponse(SipApplicationDispatcher sipApplicationDispatcher, int errorCode, ServerTransaction transaction, Request request, SipProvider sipProvider) { try{ Response response=SipFactoryImpl.messageFactory.createResponse (errorCode,request); if (transaction!=null) { transaction.sendResponse(response); } else { sipProvider.sendResponse(response); } sipApplicationDispatcher.updateResponseStatistics(response, false); } catch (Exception e) { logger.error("Problem while sending the error response to the following request " + request.toString(), e); } }
logger.debug("transaction dialog "+ transaction.getDialog()); && (RoutingState.INITIAL.equals(originalRequest.getRoutingState()) || RoutingState.RELAYED.equals(originalRequest.getRoutingState())) && 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(); final Dialog dialog = transaction == null ? null:transaction.getDialog(); logger.debug("Sending response " + message + " through tx " + transaction); if(proxy != null && transaction.getDialog() != null && transaction instanceof SIPServerTransaction) { transaction.sendResponse( (Response)this.message ); sipFactoryImpl.getSipApplicationDispatcher().updateResponseStatistics((Response)this.message, false); if(dialog != null) {
} else { ServerTransaction txn = getServerTransaction(); Request request = txn.getRequest();
final TransactionApplicationData inviteAppData = (TransactionApplicationData)inviteTransaction.getApplicationData(); if(inviteAppData == null) { if(logger.isDebugEnabled()) {
private void sendResponse(RequestEvent event, int responseCode) throws SipException, InvalidArgumentException, ParseException { event.getServerTransaction().sendResponse( sipProvider.getMessageFactory().createResponse(responseCode, event.getRequest())); }
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()); }
TransactionApplicationData transactionApplicationData = (TransactionApplicationData)transaction.getApplicationData(); if(transactionApplicationData != null && transactionApplicationData.getInitialPoppedRoute() == null) { transactionApplicationData.setInitialPoppedRoute(new AddressImpl(routeHeader.getAddress(), null, ModifiableRule.NotModifiable));
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 respond(RequestEvent evt, int cause) { Request request = evt.getRequest(); ServerTransaction tx = evt.getServerTransaction(); try { Response response = messageFactory.createResponse(cause, request); tx.sendResponse(response); } catch (Exception e) { logger.warning("Unexpected error: ", e); } }
this.dialog = st.getDialog(); st.sendResponse(response);
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()); }
serverTransaction.getApplicationData()).getSipServletMessage().getTransaction(); if(transaction == null || transaction instanceof ServerTransaction) { ClientTransaction ctx = sipProvider.getNewClientTransaction(clonedRequest); ctx.setApplicationData(appData); ((TransactionApplicationData)serverTransaction.getApplicationData()).setTransaction(ctx); if(logger.isInfoEnabled()) { logger.info("Sending the request through a new client transaction " + clonedRequest); appData.setModifier(modifier); ((TransactionApplicationData)serverTransaction.getApplicationData()).setTransaction(transaction); if(logger.isInfoEnabled()) { logger.info("Sending the request through the existing transaction " + clonedRequest); clientTransaction.setApplicationData(appData); ((TransactionApplicationData)serverTransaction.getApplicationData()).setTransaction(clientTransaction); dialog.setApplicationData(appData); if(logger.isInfoEnabled()) {
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 respond(RequestEvent evt, int cause) { Request request = evt.getRequest(); ServerTransaction tx = evt.getServerTransaction(); try { Response response = messageFactory.createResponse(cause, request); tx.sendResponse(response); } catch (Exception e) { logger.warning("Unexpected error: ", e); } }
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 replyToRequestEvent(RequestEvent event, int status) { try { event.getServerTransaction().sendResponse( sipProvider.getMessageFactory().createResponse(status, event.getRequest())); } catch (Throwable e) { tracer.severe("Failed to reply to request event:\n" + event, 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); } } }