private void sendResponse(RequestEvent event, int responseCode) throws SipException, InvalidArgumentException, ParseException { event.getServerTransaction().sendResponse( sipProvider.getMessageFactory().createResponse(responseCode, event.getRequest())); }
public void execute(RequestEvent event) { Request request = event.getRequest(); final String calleeCallId = ((CallIdHeader) request .getHeader(CallIdHeader.NAME)).getCallId(); String method = request.getMethod(); if (Request.BYE.equals(method)) { handleBye(calleeCallId, request); } }
public void processSubscribe(RequestEvent requestEvent, ServerTransaction serverTransaction) { SipProvider sipProvider = (SipProvider) requestEvent.getSource(); Request request = requestEvent.getRequest(); try { LOG.debug("SipPresenceAgentListener: Received a Subscribe request, sending OK"); ServerTransaction st = requestEvent.getServerTransaction(); if (st == null) { st = sipProvider.getNewServerTransaction(request); boolean isInitial = requestEvent.getDialog() == null; if (isInitial) { String toTag = UUID.randomUUID().toString();
public void onNotify(RequestEvent event, ActivityContextInterface aci) { if (tracer.isFineEnabled()) tracer.fine("Received Notify, on activity: " + aci.getActivity() + "\nRequest:\n" + event.getRequest()); Request request = event.getRequest(); SubscriptionData subscriptionData = getSubscriptionDataCMP(); EventHeader eventHeader = (EventHeader) request.getHeader(EventHeader.NAME); try { Response badEventResponse = this.messageFactory.createResponse(Response.BAD_EVENT, request); event.getServerTransaction().sendResponse(badEventResponse); event.getServerTransaction().sendResponse(okResponse); } catch (Exception e) { if (tracer.isSevereEnabled()) { event.getDialog().delete();
/** * 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 synchronized void processNotify(RequestEvent requestEvent, ServerTransaction serverTransactionId) { LOG.debug("Notification received at Subscriber"); SipProvider provider = (SipProvider) requestEvent.getSource(); Request notify = requestEvent.getRequest(); try { if (serverTransactionId == null) {
+ sipEvent.getSource()); if (sipEvent instanceof RequestEvent) { Dialog dialog = ((RequestEvent) sipEvent).getDialog(); if ( logger.isLoggingEnabled(LogLevels.TRACE_DEBUG)) logger.logDebug("Dialog = " + dialog); } else if (sipEvent instanceof ResponseEvent) {
public void execute(RequestEvent event) { Request request = event.getRequest(); final String calleeCallId = ((CallIdHeader) request .getHeader(CallIdHeader.NAME)).getCallId(); String method = request.getMethod(); if (Request.BYE.equals(method)) { handleBye(calleeCallId, request); } } }
public void processRequest(RequestEvent requestEvent) { final SipProvider sipProvider = (SipProvider)requestEvent.getSource(); ServerTransaction requestTransaction = requestEvent.getServerTransaction(); final Dialog dialog = requestEvent.getDialog(); final Request request = requestEvent.getRequest(); String method = requestEvent.getRequest().getMethod(); boolean goodMethod = method.equals(Request.ACK) || method.equals(Request.PRACK) || method.equals(Request.BYE) || method.equals(Request.CANCEL) || method.equals(Request.UPDATE) || method.equals(Request.INFO); if(logger.isDebugEnabled()) {
/** * 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 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); } }
public void execute(RequestEvent event) { Request request = event.getRequest(); final String calleeCallId = ((CallIdHeader) request .getHeader(CallIdHeader.NAME)).getCallId(); String method = request.getMethod(); if (Request.BYE.equals(method)) { handleBye(calleeCallId, request); } } }
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 processPublish(RequestEvent requestEvent, ServerTransaction serverTransactionId) { try { Request request = requestEvent.getRequest(); LOG.debug("SipPresenceAgentListener: Received a Publish request, sending OK"); LOG.debug("SipPresenceAgentListener request: {}", request); EventHeader eventHeader = (EventHeader) requestEvent.getRequest().getHeader(EventHeader.NAME); Response response = sipPresenceAgent.getConfiguration().getMessageFactory().createResponse(202, request); sipPresenceAgent.getProvider().sendResponse(response); // Send notification to subscriber sendNotification(eventHeader, false, request.getContent()); } catch (Exception e) { LOG.error("Exception thrown during publish/notify processing in the Sip Presence Agent Listener", 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); }
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); } }
private void onNonInviteEvent(javax.sip.RequestEvent event, CallForwardingSbbActivityContextInterface localAci) { localAci.detach(this.getSbbLocalObject()); // get proxy child SBB ChildRelation proxyRelation = getJainSipProxySbb(); if (!proxyRelation.isEmpty()) { // we have a child so we are processing this call, // attach the proxy so it can have a chance to cancel the invite localAci.attach((SbbLocalObject) proxyRelation.iterator().next()); log.info("########## Processing request "+event.getRequest().getMethod()+" for user "+event.getRequest().getRequestURI()); } } private LocationService locationService = new LocationService();
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); } }
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); } }