/** * {@inheritDoc} */ public void pushPath(Address uri) { checkReadOnly(); if(!Request.REGISTER.equalsIgnoreCase(((Request)message).getMethod())) { throw new IllegalStateException("Cannot push a Path on a non REGISTER request !"); } if(uri.getURI() instanceof TelURL) { throw new IllegalArgumentException("Cannot push a TelUrl as a path !"); } if (logger.isDebugEnabled()) logger.debug("Pushing path into message of value [" + uri + "]"); try { javax.sip.header.Header p = SipFactoryImpl.headerFactory .createHeader(PathHeader.NAME, uri.toString()); this.message.addFirst(p); } catch (Exception e) { logger.error("Error while pushing path [" + uri + "]"); throw new IllegalArgumentException("Error pushing path ", e); } }
try { h = SipFactoryImpl.headerFactory.createHeader(headerNameToAdd, addr .toString()); this.message.setHeader(h); } catch (ParseException e) {
Header h = SipFactoryImpl.headerFactory.createHeader(nameToAdd, addr.toString());
@Override public synchronized void dial() throws CallException { assertState(QUEUED); // Try to negotiate media with a packet relay end point. try { relayEndpoint = session.getPacketRelayEndpoint(); userAgentConnection = session.createConnection(relayEndpoint); userAgentConnection.addObserver(this); userAgentConnection.connect(ConnectionMode.SendRecv); block(1); if(!MgcpConnection.HALF_OPEN.equals(userAgentConnection.getState())) { throw new Exception(mmsTimedOutException()); } final byte[] offer = patchMedia(server.getExternalAddress(), userAgentConnection.getLocalDescriptor().toString().getBytes()); initialInvite.setContent(offer, "application/sdp"); initialInvite.send(); } catch(final Exception exception) { cleanup(); setState(FAILED); fireStatusChanged(); final StringBuilder buffer = new StringBuilder(); buffer.append("There was an error while dialing out from "); buffer.append(initialInvite.getFrom().toString()).append(" to "); buffer.append(initialInvite.getTo().toString()); throw new CallException(exception); } }