void DtmfTesterDialog::onDtmf(int event, int duration) {
  AmAudioFile* f = new AmAudioFile();
  if(f->open(DtmfTesterFactory::AnnouncePath+"/"+int2str(event)+".wav", 
		   AmAudioFile::Read)) {
    ERROR("Cannot open file %s\n", 
	  (DtmfTesterFactory::AnnouncePath+"/"+int2str(event)+".wav").c_str());
  }

  del_files.push_back(f);
  play_list.addToPlaylist(new AmPlaylistItem(f, NULL));
}
void ConferenceDialog::sayTTS(string text) {

  string filename = string(TTS_CACHE_PATH) + text /* AmSession::getNewId() */
    + string(".wav");

  last_sas = text;
  flite_text_to_speech(text.c_str(),tts_voice,filename.c_str());
  
  AmAudioFile* af = new AmAudioFile();
  if(!af->open(filename.c_str(), AmAudioFile::Read)) {
    play_list.addToPlayListFront(new AmPlaylistItem(af, NULL));
    TTSFiles.push_back(af);
  } else {
    ERROR("ERROR reading TTSed file %s\n", filename.c_str());
    delete af;
  }
}
void DSMCall::playFile(const string& name, bool loop, bool front) {
  AmAudioFile* af = new AmAudioFile();
  if(af->open(name,AmAudioFile::Read)) {
    ERROR("audio file '%s' could not be opened for reading.\n", 
	  name.c_str());
    delete af;
    
    throw DSMException("file", "path", name);

    return;
  }
  if (loop) 
    af->loop.set(true);

  if (front)
    playlist.addToPlayListFront(new AmPlaylistItem(af, NULL));
  else
    playlist.addToPlaylist(new AmPlaylistItem(af, NULL));

  audiofiles.push_back(af);
  CLR_ERRNO;
}