private ArrayList getLocalViaHeaders() throws IOException { /* * We can't keep a cached copy because the callers * of this method change the viaHeaders. In particular * a branch may be added which causes INVITES to fail. */ if (viaHeaders != null) { return viaHeaders; } ListeningPoint lp = sipProvider.getListeningPoint(); viaHeaders = new ArrayList(); try { String addr = lp.getIPAddress(); ViaHeader viaHeader = headerFactory.createViaHeader(addr, lp.getPort(), lp.getTransport(), null); viaHeader.setRPort(); viaHeaders.add(viaHeader); return viaHeaders; } catch (ParseException e) { throw new IOException( "A ParseException occurred while creating Via Headers! " + e.getMessage()); } catch (InvalidArgumentException e) { throw new IOException( "Unable to create a via header for port " + lp.getPort() + " " + e.getMessage()); } }