/** * Create a Via Header based on the host, port and transport of this listening point * @param usePublicAddress if true, the host will be the global ip address found by STUN otherwise * it will be the local network interface ipaddress * @param branch the branch id to use * @return the via header */ public ViaHeader createViaHeader(String branch, boolean usePublicAddress) { try { String host = getIpAddress(usePublicAddress); ViaHeader via = SipFactoryImpl.headerFactory.createViaHeader(host, port, transport, branch); return via; } catch (ParseException ex) { logger.error ("Unexpected error while creating a via header",ex); throw new IllegalArgumentException("Unexpected exception when creating via header ", ex); } catch (InvalidArgumentException e) { logger.error ("Unexpected error while creating a via header",e); throw new IllegalArgumentException("Unexpected exception when creating via header ", e); } }
private void createViaHeaders() throws ParseException, InvalidArgumentException { viaHeaders = new ArrayList<>(); ViaHeader viaHeader = headerFactory.createViaHeader(getFromHost(), getFromPort(), getTransport(), null); viaHeaders.add(viaHeader); }
ViaHeader viaHeader = sipHeaderFactory.createViaHeader( sipProvider.getListeningPoints()[0].getIPAddress(), sipProvider.getListeningPoints()[0].getPort(),
viaHeader = SipFactoryImpl.headerFactory.createViaHeader( proxy.getOutboundInterface().getHost(), proxy.getOutboundInterface().getPort(),
ListeningPoint listeningPoint = sipProvider.getListeningPoints()[0]; ViaHeader viaHeader = sipProvider.getHeaderFactory() .createViaHeader(listeningPoint.getIPAddress(), listeningPoint.getPort(), listeningPoint.getTransport(), null);