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); } } }
public CallIdHeader getNewCallId() { String callId = Utils.getInstance().generateCallIdentifier(this.getListeningPoint() .getIPAddress()); CallID callid = new CallID(); try { callid.setCallId(callId); } catch (java.text.ParseException ex) { } return callid; }
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())); } } } }
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;
sipProvider = (SipProvider) sipStack.getSipProviders().next(); for (ListeningPoint listeningPointTemp : sipProvider.getListeningPoints()) { if(!(listeningPointTemp.getIPAddress().equalsIgnoreCase(listeningPoint.getIPAddress()) && listeningPointTemp.getPort() == listeningPoint.getPort())) { createSipProvider = true; break;
+ transport); MessageChannel messageChannel = sipStack.createRawMessageChannel( this.getListeningPoint(hop.getTransport()).getIPAddress(), listeningPoint.port, hop); messageChannel.sendMessage(sipResponse);
sipProvider.getListeningPoints()[0].getIPAddress(), sipProvider.getListeningPoints()[0].getPort(), sipProvider.getListeningPoints()[0].getTransport(),
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); }
ListeningPoint listeningPoint = sipProvider.getListeningPoints()[0]; ViaHeader viaHeader = sipProvider.getHeaderFactory() .createViaHeader(listeningPoint.getIPAddress(), listeningPoint.getPort(), listeningPoint.getTransport(), null);
.toUpperCase())) { messageChannel = sipStack.createRawMessageChannel( this.getListeningPoint(hop.getTransport()).getIPAddress(), this.getListeningPoint(hop.getTransport()).getPort(), hop);
String localAddress = provider.getListeningPoints()[0].getIPAddress(); int localPort = provider.getListeningPoints()[0].getPort();
String localAddress = provider.getListeningPoints()[0].getIPAddress(); int localPort = provider.getListeningPoints()[0].getPort();
String localAddress = getSipFactoryProvider().getListeningPoints()[0].getIPAddress(); int localPort = getSipFactoryProvider().getListeningPoints()[0].getPort();