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()); } }
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 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 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 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 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();
private void sendResponse(RequestEvent event, int responseCode) throws SipException, InvalidArgumentException, ParseException { event.getServerTransaction().sendResponse( sipProvider.getMessageFactory().createResponse(responseCode, event.getRequest())); }
public InitialEventSelector callIDSelect(InitialEventSelector ies) { Object event = ies.getEvent(); String callID = null; if (event instanceof RequestEvent) { // If request event, the convergence name to callId Request request = ((RequestEvent) event).getRequest(); callID = ((CallIdHeader) request.getHeader(CallIdHeader.NAME)).getCallId(); } ies.setCustomName(callID); return ies; }
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 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 method is used to know if the it is going to be used the voice mail * of the same user or the voice mail of a different user. * * @param event * @return TRUE: If the called user is sip:vmail@nist.gov */ private boolean sameUser(javax.sip.RequestEvent event) { boolean sameUser = false; Request inviteRequest = event.getRequest(); // Checking if the called user and the caller are the same ToHeader toHeader = (ToHeader) inviteRequest.getHeader(ToHeader.NAME); SipURI toURI = (SipURI) toHeader.getAddress().getURI(); if ((toURI.getUser().equals(USER) && toURI.getHost().equals(HOST))) { sameUser = true; } // Setting Same User value this.setSameUser(sameUser); return sameUser; }
public void execute(RequestEvent event) { Request request = event.getRequest(); final String method = request.getMethod(); if (method.equals(Request.BYE)) { final String callId = ((CallIdHeader) request .getHeader(CallIdHeader.NAME)).getCallId(); Dialog dialog = getPeerDialog(callId); try { sipUtils.sendOk(request); sendRequest(dialog, Request.BYE); } catch (ParseException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (SipException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } setState(new UATerminationState(), callId); } } }
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); } }
private void executeRequestState(RequestEvent event) { String callId = ((CallIdHeader) event.getRequest().getHeader( CallIdHeader.NAME)).getCallId(); SessionAssociation sa = (SessionAssociation) cache.get(callId); SimpleCallFlowState simpleCallFlowState = getState(sa.getState()); simpleCallFlowState.execute(event); }
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(); } }
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); } }
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); } }