use of org.apache.camel.component.sip.listener.SipSubscriptionListener in project camel by apache.
the class SipSubscriber method doStart.
@Override
protected void doStart() throws Exception {
super.doStart();
Properties properties = configuration.createInitialProperties();
sipStack = configuration.getSipFactory().createSipStack(properties);
configuration.parseURI();
sipSubscriptionListener = new SipSubscriptionListener(this);
ListeningPoint listeningPoint = sipStack.createListeningPoint(configuration.getFromHost(), Integer.valueOf(configuration.getFromPort()).intValue(), configuration.getTransport());
configuration.setListeningPoint(listeningPoint);
provider = sipStack.createSipProvider(configuration.getListeningPoint());
provider.addSipListener(sipSubscriptionListener);
if (configuration.getCallIdHeader() == null) {
configuration.setCallIdHeader(provider.getNewCallId());
}
// Create the Subscription request to register with the presence agent and receive notifications.
configuration.setCallIdHeader(provider.getNewCallId());
Request request = configuration.createSipRequest(1, Request.SUBSCRIBE, configuration.getEventHeaderName());
// Create the subscriber transaction from request.
ClientTransaction subscriberTransactionId = provider.getNewClientTransaction(request);
// Add an Event header for the subscription.
request.addHeader(configuration.getEventHeader());
subscriberDialog = subscriberTransactionId.getDialog();
// Send the outgoing subscription request.
subscriberTransactionId.sendRequest();
}
Aggregations