public void addSipConnector(ListeningPoint listeningPoint, SipLoadBalancer loadBalancer) { if(logger.isLoggingEnabled(StackLogger.TRACE_INFO)){ logger.logInfo("Adding Listening Point to be using the Load Balancer " + loadBalancer + " for outbound traffic " + listeningPoint.getIPAddress() + ":" + listeningPoint.getPort() + "/" + listeningPoint.getTransport()); logger.logInfo("Recomputing SIP Nodes to be sent to the LB"); } // https://github.com/RestComm/jain-sip.ha/issues/3 we restrict only if one connector is passed forcefully this way useLoadBalancerForAllConnectors = false; Set<ListeningPoint> sipConnectors = connectors.get(loadBalancer); if(sipConnectors == null) { sipConnectors = new CopyOnWriteArraySet<ListeningPoint>(); connectors.put(loadBalancer, sipConnectors); } sipConnectors.add(listeningPoint); updateConnectorsAsSIPNode(loadBalancer); // notify the listeners for (LoadBalancerHeartBeatingListener loadBalancerHeartBeatingListener : loadBalancerHeartBeatingListeners) { loadBalancerHeartBeatingListener.loadBalancerAdded(loadBalancer); } }
public void addSipConnector(ListeningPoint listeningPoint) { if(logger.isLoggingEnabled(StackLogger.TRACE_INFO)){ logger.logInfo("Adding Listening Point to be using the Load Balancer for outbound traffic " + listeningPoint.getIPAddress() + ":" + listeningPoint.getPort() + "/" + listeningPoint.getTransport()); logger.logInfo("Recomputing SIP Nodes to be sent to the LB"); } // https://github.com/RestComm/jain-sip.ha/issues/3 we restrict only if one connector is passed forcefully this way useLoadBalancerForAllConnectors = false; sipConnectors.add(listeningPoint); updateConnectorsAsSIPNode(); }
public void removeSipConnector(ListeningPoint listeningPoint) { if(logger.isLoggingEnabled(StackLogger.TRACE_INFO)){ logger.logInfo("Removing Listening Point to be using the Load Balancer for outbound traffic " + listeningPoint.getIPAddress() + ":" + listeningPoint.getPort() + "/" + listeningPoint.getTransport()); logger.logInfo("Recomputing SIP Nodes to be sent to the LB"); } sipConnectors.remove(listeningPoint); updateConnectorsAsSIPNode(); } }
public void removeSipConnector(ListeningPoint listeningPoint, SipLoadBalancer loadBalancer) { if(logger.isLoggingEnabled(StackLogger.TRACE_INFO)){ logger.logInfo("Removing Listening Point to be using the Load Balancer " + loadBalancer + " for outbound traffic " + listeningPoint.getIPAddress() + ":" + listeningPoint.getPort() + "/" + listeningPoint.getTransport()); logger.logInfo("Recomputing SIP Nodes to be sent to the LB"); } // https://github.com/RestComm/jain-sip.ha/issues/3 we restrict only if one connector is passed forcefully this way useLoadBalancerForAllConnectors = false; Set<ListeningPoint> sipConnectors = connectors.get(loadBalancer); sipConnectors.remove(listeningPoint); updateConnectorsAsSIPNode(loadBalancer); // notify the listeners for (LoadBalancerHeartBeatingListener loadBalancerHeartBeatingListener : loadBalancerHeartBeatingListeners) { loadBalancerHeartBeatingListener.loadBalancerRemoved(loadBalancer); } } }
private ContactHeader getContactHeader() throws ParseException { if (contactHeader == null) { ListeningPoint listeningPoint = sipFactoryProvider .getListeningPoint("udp"); Address address = addressFactory.createAddress( "Mobicents SIP AS <sip:"+listeningPoint.getIPAddress()+">"); ((SipURI) address.getURI()).setPort(listeningPoint.getPort()); contactHeader = headerFactory.createContactHeader(address); } return contactHeader; }
public void runTask() { if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) { logger.logDebug( "~~~ Starting processing of KeepAliveTimeoutEvent( " + peerAddress.getHostAddress() + "," + peerPort + ")..."); } close(true, true); if(sipStack instanceof SipStackImpl) { for (Iterator<SipProviderImpl> it = ((SipStackImpl)sipStack).getSipProviders(); it.hasNext();) { SipProviderImpl nextProvider = (SipProviderImpl) it.next(); SipListener sipListener= nextProvider.getSipListener(); ListeningPoint[] listeningPoints = nextProvider.getListeningPoints(); for(ListeningPoint listeningPoint : listeningPoints) { if(sipListener!= null && sipListener instanceof SipListenerExt // making sure that we don't notify each listening point but only the one on which the timeout happened && listeningPoint.getIPAddress().equalsIgnoreCase(myAddress) && listeningPoint.getPort() == myPort && listeningPoint.getTransport().equalsIgnoreCase(getTransport())) { ((SipListenerExt)sipListener).processIOException(new IOExceptionEventExt(nextProvider, Reason.KeepAliveTimeout, myAddress, myPort, peerAddress.getHostAddress(), peerPort, getTransport())); } } } } else { SipListener sipListener = sipStack.getSipListener(); if(sipListener instanceof SipListenerExt) { ((SipListenerExt)sipListener).processIOException(new IOExceptionEventExt(this, Reason.KeepAliveTimeout, myAddress, myPort, peerAddress.getHostAddress(), peerPort, getTransport())); } } } }
/** * Updates the local dialog transient attributes that were not serialized during the replication * @param sipStackImpl the sip Stack Impl that reloaded this dialog from the distributed cache */ public void initAfterLoad(ClusteredSipStack sipStackImpl) { String transport = getLastResponseTopMostVia().getTransport(); Iterator<SipProviderImpl> providers = sipStackImpl.getSipProviders(); boolean providerNotFound = true; while(providers.hasNext()) { SipProviderImpl providerImpl = providers.next(); if(providerImpl.getListeningPoint(transport) != null) { setSipProvider(providerImpl); providerNotFound = false; } } if(providerNotFound) { throw new RuntimeException("No providers found for transport=" + transport + " on this node. Make sure connectors are configured for this transport"); } setStack((SIPTransactionStack)sipStackImpl); setAssigned(); firstTransactionPort = getSipProvider().getListeningPoint(getLastResponseTopMostVia().getTransport()).getPort(); ackProcessed = true; // ackSeen = true; }
private ContactHeader getContactHeader() throws ParseException { if (contactHeader == null) { final ListeningPoint listeningPoint = sleeSipProvider .getListeningPoint("udp"); final javax.sip.address.SipURI sipURI = addressFactory .createSipURI(null, listeningPoint.getIPAddress()); sipURI.setPort(listeningPoint.getPort()); sipURI.setTransportParam(listeningPoint.getTransport()); contactHeader = headerFactory.createContactHeader(addressFactory .createAddress(sipURI)); } return contactHeader; }
@Override protected void doStart() throws Exception { super.doStart(); Properties properties = configuration.createInitialProperties(); setSipStack(configuration.getSipFactory().createSipStack(properties)); configuration.parseURI(); if (sipPublishListener == null) { sipPublishListener = new SipPublishListener(this); } configuration.setListeningPoint( sipStack.createListeningPoint(configuration.getFromHost(), Integer.valueOf(configuration.getFromPort()).intValue(), configuration.getTransport())); boolean found = false; if (provider != null) { for (ListeningPoint listeningPoint : provider.getListeningPoints()) { if (listeningPoint.getIPAddress().equalsIgnoreCase(configuration.getListeningPoint().getIPAddress()) && (listeningPoint.getPort() == configuration.getListeningPoint().getPort())) { found = true; } } } if (!found) { provider = getSipStack().createSipProvider(configuration.getListeningPoint()); provider.addSipListener(sipPublishListener); configuration.setCallIdHeader(provider.getNewCallId()); } }
sipProvider = (SipProvider) sipStack.getSipProviders().next(); for (ListeningPoint listeningPointTemp : sipProvider.getListeningPoints()) { if(!(listeningPointTemp.getIPAddress().equalsIgnoreCase(listeningPoint.getIPAddress()) && listeningPointTemp.getPort() == listeningPoint.getPort())) { createSipProvider = true; break;
logger.logDebug( "provider port = " + this.sipProvider.getListeningPoint().getPort()); logger.logStackTrace();
sipProvider = (SipProvider) sipStack.getSipProviders().next(); for (ListeningPoint listeningPointTemp : sipProvider.getListeningPoints()) { if(!(listeningPointTemp.getIPAddress().equalsIgnoreCase(listeningPoint.getIPAddress()) && listeningPointTemp.getPort() == listeningPoint.getPort())) { createSipProvider = true; break;
ViaHeader viaHeader = sipHeaderFactory.createViaHeader( sipProvider.getListeningPoints()[0].getIPAddress(), sipProvider.getListeningPoints()[0].getPort(), sipProvider.getListeningPoints()[0].getTransport(), null);
private void finishSipSessionSetup(byte[] sdp) throws ParseException, SipException, InvalidArgumentException { ServerTransaction serverTransaction = (ServerTransaction) getServerTransactionACI() .getActivity(); ContentTypeHeader contentType = sipRaSbbInterface.getHeaderFactory() .createContentTypeHeader("application", "sdp"); String localAddress = sipRaSbbInterface.getListeningPoints()[0] .getIPAddress(); int localPort = sipRaSbbInterface.getListeningPoints()[0].getPort(); Address contactAddress = sipRaSbbInterface.getAddressFactory() .createAddress("sip:" + localAddress + ":" + localPort); ContactHeader contact = sipRaSbbInterface.getHeaderFactory() .createContactHeader(contactAddress); Response ok = sipRaSbbInterface.getMessageFactory().createResponse( Response.OK, serverTransaction.getRequest(), contentType, sdp); ok.setHeader(contact); serverTransaction.sendResponse(ok); }
private void finishSipSessionSetup(byte[] sdp) throws ParseException, SipException, InvalidArgumentException { ServerTransaction serverTransaction = (ServerTransaction) getServerTransactionACI() .getActivity(); ContentTypeHeader contentType = sipRaSbbInterface.getHeaderFactory() .createContentTypeHeader("application", "sdp"); String localAddress = sipRaSbbInterface.getListeningPoints()[0] .getIPAddress(); int localPort = sipRaSbbInterface.getListeningPoints()[0].getPort(); Address contactAddress = sipRaSbbInterface.getAddressFactory() .createAddress("sip:" + localAddress + ":" + localPort); ContactHeader contact = sipRaSbbInterface.getHeaderFactory() .createContactHeader(contactAddress); Response ok = sipRaSbbInterface.getMessageFactory().createResponse( Response.OK, serverTransaction.getRequest(), contentType, sdp); ok.setHeader(contact); serverTransaction.sendResponse(ok); }
ViaHeader viaHeader = sipProvider.getHeaderFactory() .createViaHeader(listeningPoint.getIPAddress(), listeningPoint.getPort(), listeningPoint.getTransport(), null); viaHeaders.add(viaHeader);
messageChannel = sipStack.createRawMessageChannel( this.getListeningPoint(hop.getTransport()).getIPAddress(), this.getListeningPoint(hop.getTransport()).getPort(), hop);
int localPort = provider.getListeningPoints()[0].getPort();
int localPort = provider.getListeningPoints()[0].getPort();
int localPort = getSipFactoryProvider().getListeningPoints()[0].getPort();