public void addFirst(Header header) throws SipException, NullPointerException { if (header == null) throw new NullPointerException("null arg!"); try { this.attachHeader((SIPHeader) header, false, true); } catch (SIPDuplicateHeaderException ex) { throw new SipException("Cannot add header - header already exists"); } }
private void processMidDialogRequest(RequestEvent event, ActivityContextInterface dialogACI) { try { // Find the dialog to forward the request on ActivityContextInterface peerACI = getPeerDialog(dialogACI); forwardRequest(event, (DialogActivity) peerACI.getActivity()); } catch (SipException e) { tracer.severe(e.getMessage(), e); replyToRequestEvent(event, Response.SERVICE_UNAVAILABLE); } }
public StringBuilder encodeBody(StringBuilder encoding) { // StringBuilder encoding = new StringBuilder(); /* * no need to check for the presence of icid-value. According to the * spec above this is a mandatory field. if it does not exist, then we * should throw an exception * * JvB 26/5: fix for issue #159, check for quotes around icid value * * Aayush: 29th November 2011 : Added fix for P-Charging-Vector header's parameters to accept quoted string values. */ gov.nist.core.NameValue nv = getNameValue( ParameterNamesIms.ICID_VALUE ); if(nv!=null) this.parameters.encode(encoding); else try { throw new SipException("icid-value is mandatory"); } catch (SipException e) { e.printStackTrace(); } return encoding; }
public void onByeEvent(RequestEvent event, ActivityContextInterface aci) { log.info("************Received BYEEEE**************"); if (log.isDebugEnabled()) { log.debug("Received BYE"); } releaseMediaConnectionAndDialog(); try { sipUtils.sendStatefulOk(event); } catch (ParseException e) { e.printStackTrace(); } catch (SipException e) { e.printStackTrace(); } catch (InvalidArgumentException invalidArgEx) { invalidArgEx.printStackTrace(); } // executeRequestState(event); }
/** * Handles a BYE * * @param calleeCallId * @param request */ public void handleBye(String calleeCallId, Request request) { // Send OK to callee try { sipUtils.sendOk(request); } catch (ParseException e) { e.printStackTrace(); } catch (SipException e) { e.printStackTrace(); } // Send Cancel to caller sendRequestCancel(getPeerDialog(calleeCallId)); setState(new UATerminationState(), calleeCallId); }
public void addLast(Header header) throws SipException, NullPointerException { if (header == null) throw new NullPointerException("null arg!"); try { this.attachHeader((SIPHeader) header, false, false); } catch (SIPDuplicateHeaderException ex) { throw new SipException("Cannot add header - header already exists"); } }
log.error(e.getMessage(), e); } catch (SipException e) { log.error(e.getMessage(), e); } catch (InvalidArgumentException e) { log.error(e.getMessage(), e);
public void sendCallerAck(ResponseEvent event) { try { Dialog dialog = sipUtils.getDialog(event); Request ackRequest = sipUtils.buildAck(dialog, null); dialog.sendAck(ackRequest); } catch (SipException e) { e.printStackTrace(); } }
public Request createRequest(String method) throws SipException { if (method.equals(Request.ACK) || method.equals(Request.PRACK)) { throw new SipException( "Invalid method specified for createRequest:" + method); } if (lastResponseTopMostVia != null) return this.createRequest(method, this.lastResponseTopMostVia .getTransport()); else throw new SipException("Dialog not yet established -- no response!"); }
private void processResponse(ResponseEvent event, ActivityContextInterface aci) { try { // Find the dialog to forward the response on ActivityContextInterface peerACI = getPeerDialog(aci); forwardResponse((DialogActivity) aci.getActivity(), (DialogActivity) peerACI.getActivity(), event .getClientTransaction(), event.getResponse()); } catch (SipException e) { tracer.severe(e.getMessage(), e); } }
/** * The cancel request uses the same sequence number as the invite it is ment * to cancel and thus needs to be treated specially. I.e. retrive the * sequence number from this invite and use this in the new cancel request. * * @param dialog * The dialog of the UA where the cancel is to be sent. */ private void sendRequestCancel(Dialog dialog) { // Send to callee try { // Retrieve the client transacation to cancel Session session = getSession(dialog); ClientTransaction ct = session.getToBeCancelledClientTransaction(); sipUtils.sendCancel(ct); } catch (SipException e) { e.printStackTrace(); } }
@Override public void start() throws ProviderDoesNotExistException, SipException { super.start(); String mBeanName=JAIN_SIP_MBEAN_NAME + stackName; try { oname = new ObjectName(mBeanName); if (getMBeanServer() != null && !getMBeanServer().isRegistered(oname)) { getMBeanServer().registerMBean(this, oname); } } catch (Exception e) { logger.logError("Could not register the stack as an MBean under the following name", e); throw new SipException("Could not register the stack as an MBean under the following name " + mBeanName + ", cause: " + e.getMessage(), e); } }
private void sendServerError(String message, int errorCode) { try { Response response = getMessageFactory() .createResponse( Response.SERVER_INTERNAL_ERROR, this.getInviteRequest(), getHeaderFactory().createContentTypeHeader("text", "plain"), message.getBytes()); this.getServerTransaction().sendResponse(response); } catch (ParseException e) { log.severe(e.getMessage(), e); } catch (SipException e) { log.severe(e.getMessage(), e); } catch (InvalidArgumentException e) { log.severe(e.getMessage(), e); } releaseState(); }
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); } } }
@Override public void start() throws ProviderDoesNotExistException, SipException { try { sipCache.start(); } catch (Exception e) { throw new SipException("Unable to start the SipCache", e); } if(loadBalancerHeartBeatingService != null) { loadBalancerHeartBeatingService.start(); } super.start(); }
log.severe(e.getMessage(), e); } catch (SipException e) { log.severe(e.getMessage(), e); } catch (InvalidArgumentException e) { log.severe(e.getMessage(), e);
/** * Accepts a response event and sends an ACK (containing the sdp from this * event) to the callee. * * @param event */ private void sendCalleeAck(ResponseEvent event) { log.debug("Sending Calee ACK event ResposneEvent = " + event); try { ClientTransaction ct = event.getClientTransaction(); final String callerCallId = ((CallIdHeader) ct.getRequest() .getHeader(CallIdHeader.NAME)).getCallId(); Dialog calleeDialog = getPeerDialog(callerCallId); Object content = event.getResponse().getContent(); log.debug("Building ACK content = " + content + " Dialog = " + calleeDialog); Request ackRequest = sipUtils.buildAck(calleeDialog, content); calleeDialog.sendAck(ackRequest); } catch (SipException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
private ActivityContextInterface getPeerDialog(ActivityContextInterface aci) throws SipException { final ActivityContextInterface incomingDialogAci = getIncomingDialog(); if (aci.equals(incomingDialogAci)) { return getOutgoingDialog(); } if (aci.equals(getOutgoingDialog())) { return incomingDialogAci; } throw new SipException("could not find peer dialog"); }
/** * Voice Mail will hang up on caller sending a BYE Request. * */ private void sendByeRequest() { log.info("########## VOICE MAIL SBB: sendByRequest ##########"); try { SipProvider sipProvider = getSipFactoryProvider(); Dialog dialog = this.getDialog(); if(dialog == null) { return; } Request request = dialog.createRequest(Request.BYE); ClientTransaction ct = sipProvider.getNewClientTransaction(request); dialog.sendRequest(ct); releaseState(); } catch (TransactionUnavailableException e) { log.severe(e.getMessage(), e); } catch (SipException e) { log.severe(e.getMessage(), e); } }
public void onConnectionCreated(MsConnectionEvent evt, ActivityContextInterface aci) { log.info("--------------onConnectionCreated--------------"); MsConnection connection = evt.getConnection(); log.info("Created RTP connection [" + connection.getEndpoint() + "]"); try { Dialog dialog = sipUtils.getDialog(getResponseEventCmp()); Request ackRequest = sipUtils.buildAck(dialog, connection .getLocalDescriptor()); dialog.sendAck(ackRequest); } catch (SipException e) { e.printStackTrace(); } MsSession session = connection.getSession(); MsLink link = session.createLink(MsLinkMode.FULL_DUPLEX); ActivityContextInterface linkActivity = null; try { linkActivity = mediaAcif.getActivityContextInterface(link); } catch (UnrecognizedActivityException ex) { ex.printStackTrace(); } linkActivity.attach(getParentCmp()); link.join(connection.getEndpoint(), ANNOUNCEMENT_ENDPOINT); }