public void processRequest(RequestEvent requestReceivedEvent) { Request request = requestReceivedEvent.getRequest(); ServerTransaction serverTransactionId = requestReceivedEvent .getServerTransaction(); String viaBranch = ((ViaHeader)(request.getHeaders(ViaHeader.NAME).next())).getParameter("branch"); LOG.debug("Request: {}", request.getMethod()); LOG.debug("Server Transaction Id: {}", serverTransactionId); LOG.debug("Received From Branch: {}", viaBranch); if (request.getMethod().equals(Request.NOTIFY)) { processNotify(requestReceivedEvent, serverTransactionId); } }
public void processRequest(RequestEvent requestEvent) { Request request = requestEvent.getRequest(); ServerTransaction serverTransactionId = requestEvent.getServerTransaction(); LOG.debug("Request: {}", request.getMethod()); LOG.debug("Server Transaction Id: {}", serverTransactionId); if (request.getMethod().equals(Request.SUBSCRIBE)) { processSubscribe(requestEvent, serverTransactionId); } else if (request.getMethod().equals(Request.PUBLISH)) { processPublish(requestEvent, serverTransactionId); } else { LOG.debug("Received expected request with method: {}. No further processing done", request.getMethod()); } }
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 sendResponse(RequestEvent event, int responseCode) throws SipException, InvalidArgumentException, ParseException { event.getServerTransaction().sendResponse( sipProvider.getMessageFactory().createResponse(responseCode, event.getRequest())); }
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 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); } }
/** * After receiving a BYE Request, an OK Respose has to be sent. * * @param byeEvent */ private void byeRequestOkResponse(RequestEvent byeEvent) { log.info("########## VOICE MAIL SBB: byeRequestOkResponse ##########"); Request request = byeEvent.getRequest(); ServerTransaction tx = byeEvent.getServerTransaction(); try { Response response = getMessageFactory().createResponse(Response.OK, request); tx.sendResponse(response); } catch (Exception e) { log.severe(e.getMessage(), e); } }
ServerTransaction st = requestEvent.getServerTransaction(); if (st == null) { st = sipProvider.getNewServerTransaction(request);
public void onCallTerminated(RequestEvent evt, ActivityContextInterface aci) { EndpointIdentifier endpointID = new EndpointIdentifier(this.getEndpointName(), JBOSS_BIND_ADDRESS + ":" + MGCP_PEER_PORT); DeleteConnection deleteConnection = new DeleteConnection(this, endpointID); deleteConnection.setTransactionHandle(mgcpProvider.getUniqueTransactionHandler()); mgcpProvider.sendMgcpEvents(new JainMgcpEvent[] { deleteConnection }); ServerTransaction tx = evt.getServerTransaction(); Request request = evt.getRequest(); try { Response response = messageFactory.createResponse(Response.OK, request); tx.sendResponse(response); } catch (Exception e) { logger.severe("Error while sending DLCX ", e); } }
/** * Handles the event notifying new SIP session invitation. * * @param event * @param aci */ public void onInvite(RequestEvent event, ActivityContextInterface aci) { tracer.info("Received new SIP session invitation."); try { initialSipSessionSetup(event, aci); } catch (Exception e) { tracer.severe("Failed to do initial sip session setup.", e); abortSipSessionSetup(); return; } try { initialMediaSessionSetup(event.getServerTransaction()); } catch (Exception e) { tracer.severe("Failed to process sip invite", e); abortSipSessionSetup(); abortMediaSessionSetup(); } }
public void onInviteEvent(javax.sip.RequestEvent requestEvent, ActivityContextInterface aci) { try { ServerTransaction serverTransaction = requestEvent.getServerTransaction(); // send 100 // serverTransaction.sendResponse(messageFactory.createResponse(100,requestEvent.getRequest())); // create dialog and attach this entity to it's aci DialogActivity dialog = (DialogActivity) sipFactoryProvider.getNewDialog(serverTransaction); sipActivityContextInterfaceFactory.getActivityContextInterface(dialog).attach(this.sbbContext.getSbbLocalObject()); // send 200 ok Response response = messageFactory .createResponse(Response.OK,requestEvent.getRequest()); response.addHeader(getContactHeader()); ((ToHeader)response.getHeader(ToHeader.NAME)).setTag(Utils.getInstance().generateTag()); serverTransaction.sendResponse(response); } catch (Exception ex) { ex.printStackTrace(); } }
/** * Handles the event notifying new SIP session invitation. * * @param event * @param aci */ public void onInvite(RequestEvent event, ActivityContextInterface aci) { tracer.info("Received new SIP session invitation."); try { initialSipSessionSetup(event, aci); } catch (Exception e) { tracer.severe("Failed to do initial sip session setup.", e); abortSipSessionSetup(); return; } try { initialMediaSessionSetup(event.getServerTransaction()); } catch (Exception e) { tracer.severe("Failed to process sip invite", e); abortSipSessionSetup(); abortMediaSessionSetup(); } }
private void forwardRequest(RequestEvent event, DialogActivity out) throws SipException { final Request incomingRequest = event.getRequest(); if (tracer.isInfoEnabled()) { tracer.info("Forwarding request " + incomingRequest.getMethod() + " to dialog " + out); } // Copies the request, setting the appropriate headers for the dialog. Request outgoingRequest = out.createRequest(incomingRequest); outgoingRequest.setRequestURI(out.getRemoteParty().getURI()); // Send the request on the dialog activity final ClientTransaction ct = out.sendRequest(outgoingRequest); // Record an association with the original server transaction, // so we can retrieve it when forwarding the response. out.associateServerTransaction(ct, event.getServerTransaction()); }
public void onCallTerminated(RequestEvent evt, ActivityContextInterface aci) { try { MgcpConnectionActivity activity = getMgcpConnectionActivity(); DeleteConnection deleteConnection = new DeleteConnection(this, activity.getEndpointIdentifier()); deleteConnection.setTransactionHandle(mgcpProvider.getUniqueTransactionHandler()); mgcpProvider.sendMgcpEvents(new JainMgcpEvent[] { deleteConnection }); ServerTransaction tx = evt.getServerTransaction(); Request request = evt.getRequest(); Response response = messageFactory.createResponse(Response.OK, request); tx.sendResponse(response); cancelTimer(); } catch (Exception e) { logger.severe("Error while sending OK for BYE", 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 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); }
public void onInviteEvent(RequestEvent event, ActivityContextInterface aci) { // ACI is the server transaction activity try { // send "trying" response replyToRequestEvent(event, Response.TRYING); // Create the dialogs representing the incoming and outgoing call // legs. final DialogActivity incomingDialog = (DialogActivity) sipProvider .getNewDialog(event.getServerTransaction()); final DialogActivity outgoingDialog = sipProvider.getNewDialog( incomingDialog, true); // Obtain the dialog activity contexts and attach to them final ActivityContextInterface outgoingDialogACI = sipActivityContextInterfaceFactory .getActivityContextInterface(outgoingDialog); final ActivityContextInterface incomingDialogACI = sipActivityContextInterfaceFactory .getActivityContextInterface(incomingDialog); final SbbLocalObject sbbLocalObject = sbbContext .getSbbLocalObject(); incomingDialogACI.attach(sbbLocalObject); outgoingDialogACI.attach(sbbLocalObject); // Record which dialog is which, so we can find the peer dialog // when forwarding messages between dialogs. setIncomingDialog(incomingDialogACI); setOutgoingDialog(outgoingDialogACI); forwardRequest(event, outgoingDialog); } catch (Throwable e) { tracer.severe("Failed to process incoming INVITE.", e); replyToRequestEvent(event, Response.SERVICE_UNAVAILABLE); } }
Dialog dialog = provider.getNewDialog(evt.getServerTransaction()); dialog.terminateOnBye(true); daci = acif.getActivityContextInterface((DialogActivity) dialog);
Dialog dialog = provider.getNewDialog(evt.getServerTransaction()); dialog.terminateOnBye(true); daci = acif.getActivityContextInterface((DialogActivity) dialog);