/** * Creates a new ToHeader based on the newly supplied address and * tag values. * * @param address - the new Address object of the address. * @param tag - the new string value of the tag. * @throws ParseException which signals that an error has been reached * unexpectedly while parsing the tag value. * @return the newly created ToHeader object. */ public ToHeader createToHeader(Address address, String tag) throws ParseException { if (address == null) throw new NullPointerException("null address"); To to = new To(); to.setAddress(address); if (tag != null) to.setTag(tag); return to; }
/** * Return true if the message has a To header tag. * * @return true if the message has a to header and that header has a tag. */ public boolean hasToTag() { return toHeader != null && toHeader.getTag() != null; }
/** * Encode the header into a String. * * @since 1.0 * @return String */ public String encode() { return headerName + COLON + SP + encodeBody() + NEWLINE; }
/** * Generate a TO header from a FROM header */ public To(From from) { super(TO); setAddress(from.address); setParameters(from.parameters); }
/** * This timer task is used to garbage collect the dialog after some time. * */ class DialogDeleteIfNoAckSentTask extends SIPStackTimerTask implements Serializable { private long seqno; public DialogDeleteIfNoAckSentTask(long seqno) { this.seqno = seqno; } public void runTask() { if (SIPDialog.this.highestSequenceNumberAcknowledged < seqno) { /* * Did not send ACK so we need to delete the dialog. B2BUA NOTE: * we may want to send BYE to the Dialog at this point. Do we * want to make this behavior tailorable? */ dialogDeleteIfNoAckSentTask = null; if (!SIPDialog.this.isBackToBackUserAgent) { if (logger.isLoggingEnabled()) logger.logError( "ACK Was not sent. killing dialog " + dialogId); if (((SipProviderImpl) sipProvider).getSipListener() instanceof SipListenerExt) { raiseErrorEvent(SIPDialogErrorEvent.DIALOG_ACK_NOT_SENT_TIMEOUT); } else { delete(); }
public void terminate(final SipSession session, final int calleeResponseCode, final String calleeResponseText, final int callerResponseCode, final String callerResponseText) throws IOException { if(terminationSent) { throw new IllegalStateException("Proxy Termination Already Sent !"); } sendBye (session, calleeContact, toHeader, fromHeader, callerCSeq + 1, calleeRouteSet, calleeResponseCode, calleeResponseText); sendBye (session, callerContact, new To(fromHeader), new From(toHeader), calleeCSeq + 1, callerRouteSet, callerResponseCode, callerResponseText); terminationSent = true; }
public void writeExternal(ObjectOutput out) throws IOException { out.writeLong(calleeCSeq); out.writeLong(callerCSeq); out.writeUTF(calleeContact.toString()); out.writeUTF(callerContact.toString()); out.writeInt(calleeRouteSet.size()); Iterator<javax.sip.address.Address> i = calleeRouteSet.iterator(); while (i.hasNext()) { javax.sip.address.Address a = i.next(); out.writeUTF(a.toString()); } out.writeInt(callerRouteSet.size()); i = callerRouteSet.iterator(); while (i.hasNext()) { javax.sip.address.Address a = i.next(); out.writeUTF(a.toString()); } out.writeUTF(toHeader.getAddress().toString()); out.writeUTF(toHeader.getTag()); out.writeUTF(fromHeader.getAddress().toString()); out.writeUTF(fromHeader.getTag()); out.writeUTF(callId); }
cancel.setMethod(Request.CANCEL); cancel.setHeader((Header) this.callIdHeader.clone()); cancel.setHeader((Header) this.toHeader.clone()); cancel.setHeader((Header) cSeqHeader.clone()); try {
/** * Get the tag parameter from the address parm list. * * @return tag field */ public String getTag() { if (parameters == null) return null; return getParameter(ParameterNames.TAG); }
/** * Boolean function * * @return true if the Tag exist */ public boolean hasTag() { if (parameters == null) return false; return hasParameter(ParameterNames.TAG); }
public SIPHeader parse() throws ParseException { headerName(TokenTypes.TO); To to = new To(); super.parse(to); this.lexer.match('\n'); return to; }
newRequest.setHeader((Header) responseToHeader.clone()); newRequest.addFirst((Header) this.getTopmostVia().clone()); newRequest.setHeader((Header) cSeqHeader.clone());
from.setTag(this.myTag); sipRequest.setFrom(from); To to = new To(); to.setAddress(this.getRemoteParty()); if (hisTag != null) to.setTag(this.hisTag); sipRequest.setTo(to); sipRequest.setMaxForwards(new MaxForwards(70));
public SIPHeader parse() throws ParseException { headerName(TokenTypes.TO); To to = new To(); super.parse(to); this.lexer.match('\n'); return to; }
/** * Return the to tag. */ public String getToTag() { return toHeader == null ? null : toHeader.getTag(); }
/** * Encode the header content into a String. * * @return String */ protected String encodeBody() { return encodeBody(new StringBuilder()).toString(); }
/** * Get A dialog identifier constructed from this messsage. This is an id that can be used to * identify dialogs. * * @param isServerTransaction is a flag that indicates whether this is a server transaction. */ public final String getDialogId(boolean isServer) { To to = (To) this.getTo(); return this.getDialogId( isServer, to.getTag() ); }