Search in sources :

Example 1 with SipPublishListener

use of org.apache.camel.component.sip.listener.SipPublishListener in project camel by apache.

the class SipPublisher method doStart.

@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());
    }
}
Also used : SipPublishListener(org.apache.camel.component.sip.listener.SipPublishListener) ListeningPoint(javax.sip.ListeningPoint) Properties(java.util.Properties)

Aggregations

Properties (java.util.Properties)1 ListeningPoint (javax.sip.ListeningPoint)1 SipPublishListener (org.apache.camel.component.sip.listener.SipPublishListener)1