Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see
*
*/
package org.restcomm.connect.sms.smpp;
import static javax.servlet.sip.SipServlet.OUTBOUND_INTERFACES;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.atomic.AtomicInteger;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.sip.SipFactory;
import javax.servlet.sip.SipURI;
import akka.actor.ActorRef;
import org.apache.commons.configuration.Configuration;
import org.restcomm.connect.dao.DaoManager;
import akka.actor.ActorSystem;
import akka.actor.UntypedActor;
import akka.event.Logging;
import akka.event.LoggingAdapter;
import com.cloudhopper.smpp.SmppBindType;
import com.cloudhopper.smpp.impl.DefaultSmppClient;
import com.cloudhopper.smpp.type.Address;
/**
*
* @author amit bhayani
* @author [email protected]
*
*/
public final class SmppService extends UntypedActor {
private final LoggingAdapter logger = Logging.getLogger(getContext().system(), this);
private final ActorSystem system;
private final ActorRef smppMessageHandler;
private final Configuration configuration;
private boolean authenticateUsers = true;
private final ServletConfig servletConfig;
private final SipFactory sipFactory;
private final DaoManager storage;
private final ServletContext servletContext;
private static String smppActivated;
static final int ERROR_NOTIFICATION = 0;
static final int WARNING_NOTIFICATION = 1;
private static String smppSourceAddressMap;
private static String smppDestinationAddressMap;
private static String smppTonNpiValue;
private ThreadPoolExecutor executor;
private ScheduledThreadPoolExecutor monitorExecutor;
private DefaultSmppClient clientBootstrap = null;
private SmppClientOpsThread smppClientOpsThread = null;
private ArrayList smppList = new ArrayList();
public SmppService(final ActorSystem system, final Configuration configuration, final SipFactory factory,
final DaoManager storage, final ServletContext servletContext, final ActorRef smppMessageHandler) {
super();
this.system = system;
this.smppMessageHandler = smppMessageHandler;
this.configuration = configuration;
final Configuration runtime = configuration.subset("runtime-settings");
this.authenticateUsers = runtime.getBoolean("authenticate");
this.servletConfig = (ServletConfig) configuration.getProperty(ServletConfig.class.getName());
this.sipFactory = factory;
this.storage = storage;
this.servletContext = servletContext;
Configuration config = this.configuration.subset("smpp");
smppActivated = config.getString("[@activateSmppConnection]");
//get smpp address map from restcomm.xml file
this.smppSourceAddressMap = config.getString("connections.connection[@sourceAddressMap]");
this.smppDestinationAddressMap = config.getString("connections.connection[@destinationAddressMap]");
this.smppTonNpiValue = config.getString("connections.connection[@tonNpiValue]");
this.initializeSmppConnections();
}
public static String getSmppTonNpiValue(){
return smppTonNpiValue;
}
@Override
public void onReceive(Object message) throws Exception {}
private void initializeSmppConnections() {
Configuration smppConfiguration = this.configuration.subset("smpp");
List