Via via = new Via(); if (branch != null) via.setBranch(branch);
/** * Get the Via header for this transport. Note that this does not set a branch identifier. * * @return a via header for outgoing messages sent from this channel. */ public Via getViaHeader() { Via channelViaHeader; channelViaHeader = new Via(); try { channelViaHeader.setTransport(getTransport()); } catch (ParseException ex) { } channelViaHeader.setSentBy(getHostPort()); return channelViaHeader; }
/** * Get the Via header to assign for this message processor. The topmost via * header of the outoging messages use this. * * @return the ViaHeader to be used by the messages sent via this message processor. */ public Via getViaHeader() { try { Via via = new Via(); if (this.sentByHostPort != null) { via.setSentBy(sentByHostPort); via.setTransport(this.getTransport()); } else { Host host = new Host(); host.setHostname(this.getIpAddress().getHostAddress()); via.setHost(host); via.setPort(this.getPort()); via.setTransport(this.getTransport()); } return via; } catch (ParseException ex) { ex.printStackTrace(); return null; } catch (InvalidArgumentException ex) { ex.printStackTrace(); return null; } } public ListeningPointImpl getListeningPoint() {
public SIPHeader parse() throws ParseException { if (debug) dbg_enter("parse"); try { ViaList viaList = new ViaList(); // The first via header. this.lexer.match(TokenTypes.VIA); this.lexer.SPorHT(); // ignore blanks this.lexer.match(':'); // expect a colon. this.lexer.SPorHT(); // ingore blanks. while (true) { Via v = new Via(); parseVia(v); viaList.add(v); this.lexer.SPorHT(); // eat whitespace. if (this.lexer.lookAhead(0) == ',') { this.lexer.consume(1); // Consume the comma this.lexer.SPorHT(); // Ignore space after. } if (this.lexer.lookAhead(0) == '\n') break; } this.lexer.match('\n'); return viaList; } finally { if (debug) dbg_leave("parse"); } }
public SIPHeader parse() throws ParseException { if (debug) dbg_enter("parse"); try { ViaList viaList = new ViaList(); // The first via header. this.lexer.match(TokenTypes.VIA); this.lexer.SPorHT(); // ignore blanks this.lexer.match(':'); // expect a colon. this.lexer.SPorHT(); // ingore blanks. while (true) { Via v = new Via(); parseVia(v); viaList.add(v); this.lexer.SPorHT(); // eat whitespace. if (this.lexer.lookAhead(0) == ',') { this.lexer.consume(1); // Consume the comma this.lexer.SPorHT(); // Ignore space after. } if (this.lexer.lookAhead(0) == '\n') break; } this.lexer.match('\n'); return viaList; } finally { if (debug) dbg_leave("parse"); } }