fixed code indentation

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

@ -46,53 +46,53 @@ AnnouncementFactory::AnnouncementFactory(const string& _app_name)
int AnnouncementFactory::onLoad()
{
AmConfigReader cfg;
if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
return -1;
AmConfigReader cfg;
if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
return -1;
// get application specific global parameters
configureModule(cfg);
// get application specific global parameters
configureModule(cfg);
AnnouncePath = cfg.getParameter("announce_path",ANNOUNCE_PATH);
if( !AnnouncePath.empty()
&& AnnouncePath[AnnouncePath.length()-1] != '/' )
AnnouncePath += "/";
AnnouncePath = cfg.getParameter("announce_path",ANNOUNCE_PATH);
if( !AnnouncePath.empty()
&& AnnouncePath[AnnouncePath.length()-1] != '/' )
AnnouncePath += "/";
AnnounceFile = cfg.getParameter("default_announce",ANNOUNCE_FILE);
AnnounceFile = cfg.getParameter("default_announce",ANNOUNCE_FILE);
string announce_file = AnnouncePath + AnnounceFile;
if(!file_exists(announce_file)){
ERROR("default file for announcement module does not exist ('%s').\n",
announce_file.c_str());
return -1;
}
string announce_file = AnnouncePath + AnnounceFile;
if(!file_exists(announce_file)){
ERROR("default file for announcement module does not exist ('%s').\n",
announce_file.c_str());
return -1;
}
return 0;
return 0;
}
AmSession* AnnouncementFactory::onInvite(const AmSipRequest& req)
{
string announce_path = AnnouncePath;
string announce_file = announce_path + req.domain
+ "/" + req.user + ".wav";
string announce_path = AnnouncePath;
string announce_file = announce_path + req.domain
+ "/" + req.user + ".wav";
DBG("trying '%s'\n",announce_file.c_str());
if(file_exists(announce_file))
goto end;
DBG("trying '%s'\n",announce_file.c_str());
if(file_exists(announce_file))
goto end;
announce_file = announce_path + req.user + ".wav";
DBG("trying '%s'\n",announce_file.c_str());
if(file_exists(announce_file))
goto end;
announce_file = announce_path + req.user + ".wav";
DBG("trying '%s'\n",announce_file.c_str());
if(file_exists(announce_file))
goto end;
announce_file = AnnouncePath + AnnounceFile;
announce_file = AnnouncePath + AnnounceFile;
end:
return new AnnouncementDialog(announce_file);
end:
return new AnnouncementDialog(announce_file);
}
AnnouncementDialog::AnnouncementDialog(const string& filename)
: filename(filename)
: filename(filename)
{
}
@ -102,43 +102,43 @@ AnnouncementDialog::~AnnouncementDialog()
void AnnouncementDialog::onSessionStart(const AmSipRequest& req)
{
DBG("AnnouncementDialog::onSessionStart\n");
startSession();
DBG("AnnouncementDialog::onSessionStart\n");
startSession();
}
void AnnouncementDialog::onSessionStart(const AmSipReply& rep)
{
DBG("AnnouncementDialog::onSessionStart (SEMS originator mode)\n");
startSession();
DBG("AnnouncementDialog::onSessionStart (SEMS originator mode)\n");
startSession();
}
void AnnouncementDialog::startSession(){
// we can drop all received packets
// this disables DTMF detection as well
setReceiving(false);
// we can drop all received packets
// this disables DTMF detection as well
setReceiving(false);
if(wav_file.open(filename,AmAudioFile::Read))
throw string("AnnouncementDialog::onSessionStart: Cannot open file\n");
if(wav_file.open(filename,AmAudioFile::Read))
throw string("AnnouncementDialog::onSessionStart: Cannot open file\n");
setOutput(&wav_file);
setOutput(&wav_file);
}
void AnnouncementDialog::onBye(const AmSipRequest& req)
{
DBG("onBye: stopSession\n");
setStopped();
DBG("onBye: stopSession\n");
setStopped();
}
void AnnouncementDialog::process(AmEvent* event)
{
AmAudioEvent* audio_event = dynamic_cast<AmAudioEvent*>(event);
if(audio_event && (audio_event->event_id == AmAudioEvent::cleared)){
dlg.bye();
setStopped();
return;
}
AmAudioEvent* audio_event = dynamic_cast<AmAudioEvent*>(event);
if(audio_event && (audio_event->event_id == AmAudioEvent::cleared)){
dlg.bye();
setStopped();
return;
}
AmSession::process(event);
AmSession::process(event);
}

@ -37,31 +37,31 @@ using std::string;
class AnnouncementFactory: public AmSessionFactory
{
public:
static string AnnouncePath;
static string AnnounceFile;
static string AnnouncePath;
static string AnnounceFile;
AnnouncementFactory(const string& _app_name);
AnnouncementFactory(const string& _app_name);
int onLoad();
AmSession* onInvite(const AmSipRequest& req);
int onLoad();
AmSession* onInvite(const AmSipRequest& req);
};
class AnnouncementDialog : public AmSession
{
AmAudioFile wav_file;
string filename;
AmAudioFile wav_file;
string filename;
public:
AnnouncementDialog(const string& filename);
~AnnouncementDialog();
public:
AnnouncementDialog(const string& filename);
~AnnouncementDialog();
void onSessionStart(const AmSipRequest& req);
void onSessionStart(const AmSipReply& rep);
void startSession();
void onBye(const AmSipRequest& req);
void onDtmf(int event, int duration_msec) {}
void onSessionStart(const AmSipRequest& req);
void onSessionStart(const AmSipReply& rep);
void startSession();
void onBye(const AmSipRequest& req);
void onDtmf(int event, int duration_msec) {}
void process(AmEvent* event);
void process(AmEvent* event);
};
#endif

Loading…
Cancel
Save