public Object clone() { ContactList retval = new ContactList(); retval.clonehlist(this.hlist); return retval; } /**
public Object clone() { Contact retval = (Contact) super.clone(); if (this.contactList != null) retval.contactList = (ContactList) this.contactList.clone(); return retval; }
/** * Get the contact header ( the first contact header) which is all we need for the most part. * */ public Contact getContactHeader() { ContactList clist = this.getContactHeaders(); if (clist != null) { return (Contact) clist.getFirst(); } else { return null; } }
public SIPHeader parse() throws ParseException { // past the header name and the colon. headerName(TokenTypes.CONTACT); ContactList retval = new ContactList(); while (true) { Contact contact = new Contact(); if (lexer.lookAhead(0) == '*') { final char next = lexer.lookAhead(1); if (next == ' ' || next == '\t' || next == '\r' || next == '\n') { this.lexer.match('*'); contact.setWildCardFlag(true); } else { super.parse(contact); } } else { super.parse(contact); } retval.add(contact); this.lexer.SPorHT(); char la = lexer.lookAhead(0); if (la == ',') { this.lexer.match(','); this.lexer.SPorHT(); } else if (la == '\n' || la == '\0') break; else throw createParseException("unexpected char"); } return retval; }
public SIPHeader parse() throws ParseException { // past the header name and the colon. headerName(TokenTypes.CONTACT); ContactList retval = new ContactList(); while (true) { Contact contact = new Contact(); if (lexer.lookAhead(0) == '*') { final char next = lexer.lookAhead(1); if (next == ' ' || next == '\t' || next == '\r' || next == '\n') { this.lexer.match('*'); contact.setWildCardFlag(true); } else { super.parse(contact); } } else { super.parse(contact); } retval.add(contact); this.lexer.SPorHT(); char la = lexer.lookAhead(0); if (la == ',') { this.lexer.match(','); this.lexer.SPorHT(); } else if (la == '\n' || la == '\0') break; else throw createParseException("unexpected char"); } return retval; }
/** * Do taget refresh dialog state updates. * * RFC 3261: Requests within a dialog MAY contain Record-Route and Contact * header fields. However, these requests do not cause the dialog's route * set to be modified, although they may modify the remote target URI. * Specifically, requests that are not target refresh requests do not modify * the dialog's remote target URI, and requests that are target refresh * requests do. For dialogs that have been established with an * * INVITE, the only target refresh request defined is re-INVITE (see Section * 14). Other extensions may define different target refresh requests for * dialogs established in other ways. */ private void doTargetRefresh(SIPMessage sipMessage) { ContactList contactList = sipMessage.getContactHeaders(); /* * INVITE is the target refresh for INVITE dialogs. SUBSCRIBE is the * target refresh for subscribe dialogs from the client side. This * modifies the remote target URI potentially */ if (contactList != null) { Contact contact = (Contact) contactList.getFirst(); this.setRemoteTarget(contact); } }
/** * Log a response received at this message channel. This is used for processing incoming * responses to a client transaction. * * @param receptionTime is the time at which the response was received. * @param status is the processing status of the message. * */ public void logResponse(SIPResponse sipResponse, long receptionTime, String status) { int peerport = getPeerPort(); if (peerport == 0 && sipResponse.getContactHeaders() != null) { ContactHeader contact = (ContactHeader) sipResponse.getContactHeaders().getFirst(); peerport = ((AddressImpl) contact.getAddress()).getPort(); } String from = getPeerAddress().toString() + ":" + peerport; String to = this.getHost() + ":" + getPort(); this.getSIPStack().serverLogger.logMessage(sipResponse, from, to, status, false, receptionTime); }
this.setRemoteTarget((ContactHeader) contactList.getFirst());