moving SMTP stuff to voicemail app

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@676 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 19 years ago
parent 78dd854bf7
commit 267e309d7a

@ -33,6 +33,7 @@
#include "AmUtils.h"
#include "AmPlugIn.h"
#include "AmPlaylist.h"
#include "AmMail.h"
#include "sems.h"
#include "log.h"
@ -78,6 +79,10 @@ int AnswerMachineFactory::MaxRecordTime;
int AnswerMachineFactory::MinRecordTime = 0;
AmDynInvokeFactory* AnswerMachineFactory::UserTimer=0;
string AnswerMachineFactory::SmtpServerAddress = SMTP_ADDRESS_IP;
unsigned int AnswerMachineFactory::SmtpServerPort = SMTP_PORT;
#ifdef USE_MYSQL
mysqlpp::Connection AnswerMachineFactory::Connection(mysqlpp::use_exceptions);
@ -315,10 +320,24 @@ int AnswerMachineFactory::onLoad()
AmConfigReader cfg;
if(cfg.loadFile(add2path(AmConfig::ModConfigPath,1, MOD_NAME ".conf")))
return -1;
// get application specific global parameters
configureModule(cfg);
// smtp_server
SmtpServerAddress = cfg.getParameter("smtp_server",SmtpServerAddress);
// smtp_port
if(cfg.hasParameter("smtp_port")){
if(sscanf(cfg.getParameter("smtp_port").c_str(),
"%u",&SmtpServerPort) != 1) {
ERROR("invalid smtp_port specified\n");
return -1;
}
}
DBG("SMTP server set to %s:%u\n",
SmtpServerAddress.c_str(), SmtpServerPort);
#ifdef USE_MYSQL
/* Get email templates from MySQL */
@ -395,6 +414,10 @@ int AnswerMachineFactory::onLoad()
}
EmailAddress = cfg.getParameter("email_address");
DBG("Starting SMTP daemon\n");
AmMailDeamon::instance()->start();
return 0;
}

@ -35,12 +35,15 @@
#include "AmSession.h"
#include "AmConfigReader.h"
#include "EmailTemplate.h"
#include "AmMail.h"
#include "AmPlaylist.h"
#include <string>
using std::string;
// defaults for config options
#define SMTP_ADDRESS_IP "localhost"
#define SMTP_PORT 25
class AmMail;
/** \brief Factory for voicemail sessions */
@ -65,6 +68,11 @@ public:
static int MinRecordTime;
static AmDynInvokeFactory* UserTimer;
/** After server start, IP of the SMTP server. */
static string SmtpServerAddress;
/** SMTP server port. */
static unsigned int SmtpServerPort;
#ifdef USE_MYSQL
static mysqlpp::Connection Connection;
#endif

@ -1,3 +1,17 @@
#
# optional parameter: smtp_server=<hostname>
#
# - sets address of smtp server
#
# Default: localhost
#smtp_server=mail
# optional parameter: smtp_port=<port>
#
# - sets port of smtp server
#
# Default: 25
#smtp_port=25
# if set, this overrides the email address, meaning that
# the voicemail will always be sent to that address.

@ -39,8 +39,6 @@
string AmConfig::ConfigurationFile = CONFIG_FILE;
string AmConfig::ModConfigPath = MOD_CFG_PATH;
string AmConfig::SmtpServerAddress = SMTP_ADDRESS_IP;
unsigned int AmConfig::SmtpServerPort = SMTP_PORT;
string AmConfig::PlugInPath = PLUG_IN_PATH;
string AmConfig::LoadPlugins = "";
string AmConfig::ExcludePlugins = "";
@ -75,14 +73,6 @@ int AmConfig::setSIPPort(const string& port)
return 1;
}
int AmConfig::setSmtpPort(const string& port)
{
if(sscanf(port.c_str(),"%u",&AmConfig::SmtpServerPort) != 1) {
return 0;
}
return 1;
}
int AmConfig::setRtpLowPort(const string& port)
{
if(sscanf(port.c_str(),"%i",&AmConfig::RtpLowPort) != 1) {
@ -163,17 +153,6 @@ int AmConfig::readConfiguration()
if(!ModConfigPath.empty() && (ModConfigPath[ModConfigPath.length()-1] != '/'))
ModConfigPath += '/';
// smtp_server
SmtpServerAddress = cfg.getParameter("smtp_server",SmtpServerAddress);
// smtp_port
if(cfg.hasParameter("smtp_port")){
if(!setSmtpPort(cfg.getParameter("smtp_port").c_str())){
ERROR("invalid smtp port specified\n");
return -1;
}
}
// local_ip
LocalIP = cfg.getParameter("listen");

@ -47,10 +47,6 @@ struct AmConfig
static string ConfigurationFile;
/** Path to the plug-in configuration files. */
static string ModConfigPath;
/** After server start, IP of the SMTP server. */
static string SmtpServerAddress;
/** SMTP server port. */
static unsigned int SmtpServerPort;
/** Path where the plug-ins are. */
static string PlugInPath;
/** semicolon separated list of plugins to load */

@ -28,7 +28,6 @@
#include "AmServer.h"
#include "AmSession.h"
#include "AmSdp.h"
#include "AmMail.h"
#include "AmConfig.h"
#include "AmUtils.h"
#include "AmPlugIn.h"

@ -79,16 +79,6 @@ exclude_plugins=binrpcctrl;sipctrl;
# only use G711 (exclude everything else):
# exclude_payloads=iLBC;speex;G726-40;G726-32;G721;G726-24;G726-16;GSM;L16
# optional parameter: smtp_server=<hostname>
#
# - sets address of smtp server
smtp_server=mail
# optional parameter: smtp_port=<port>
#
# - sets port of smtp server
smtp_port=25
# optional parameter: rtp_low_port=<port>
#
# - sets lowest for RTP used port

@ -30,7 +30,6 @@
#include "AmConfig.h"
#include "AmPlugIn.h"
#include "AmSessionContainer.h"
#include "AmMail.h"
#include "AmServer.h"
#include "AmMediaProcessor.h"
#include "AmIcmpWatcher.h"
@ -378,24 +377,18 @@ int main(int argc, char* argv[])
DBG("Starting media processor\n");
AmMediaProcessor::instance()->init();
DBG("Starting mailer\n");
AmMailDeamon::instance()->start();
// DBG("Starting mailer\n");
// AmMailDeamon::instance()->start();
DBG("Starting RTP receiver\n");
AmRtpReceiver::instance()->start();
//DBG("Starting Session Timer\n");
//AmSessionTimer::instance()->start();
//DBG("Starting ICMP watcher\n");
//AmIcmpWatcher::instance()->start();
if (AmServer::instance()->hasIface()) {
AmServer::instance()->run();
} else {
ERROR("Sems cannot start without a control interface plug-in.\n"
"Following plug-ins can be used: unixsockctrl, binrpcctrl and sipctrl\n"
"If SEMS should use its own SIP stack instead of SER's, please load the sipctrl plug.in\n");
"If SEMS should use its own SIP stack instead of SER's, please load the sipctrl plug-in\n");
return -1;
}

@ -37,8 +37,6 @@
#define ANNOUNCE_FILE "default.wav"
#define PLUG_IN_PATH "/usr/local/lib/sems/plug-in"
#define DEFAULT_ANNOUNCE "default.wav"
#define SMTP_ADDRESS_IP "localhost"
#define SMTP_PORT 25
#define DEFAULT_RECORD_TIME 30
#define DEFAULT_DAEMON_MODE 1
#define PREFIX_SEPARATOR ""

Loading…
Cancel
Save