void AnnounceAuthDialog::startSession(){
    // disable DTMF detection - don't use DTMF here
    setDtmfDetectionEnabled(false);

    if(wav_file.open(filename,AmAudioFile::Read))
	throw string("AnnounceAuthDialog::onSessionStart: Cannot open file\n");
    
    setOutput(&wav_file);
}
Beispiel #2
0
CallBackCalleeDialog::CallBackCalleeDialog(const string& other_tag, 
					   AmSessionAudioConnector* connector,
					   UACAuthCred* cred) 
  : AmB2ABCalleeSession(other_tag, connector), cred(cred)
{
  // set configured playout type
  RTPStream()->setPlayoutType(CallBackFactory::m_PlayoutType);
  setDtmfDetectionEnabled(false);
}
ServiceLineCalleeDialog::ServiceLineCalleeDialog(const string& other_tag) 
  : AmB2ABCalleeSession(other_tag),
    cred(ServiceLineFactory::GWAuthrealm, 
	 ServiceLineFactory::GWAuthuser, 
	 ServiceLineFactory::GWAuthpwd)
{
  rtp_str.setPlayoutType(ADAPTIVE_PLAYOUT);
  setDtmfDetectionEnabled(false);
}
void CacheAnnounceDialog::startSession(){
    setDtmfDetectionEnabled(false);

	wav_file.reset(new AmCachedAudioFile(announce));
    if (!wav_file->is_good())
		throw AmSession::Exception(500, "Internal Err");

    setOutput(wav_file.get());
}
Beispiel #5
0
void MyCCDialog::onSessionStart(const AmSipRequest& req)
{
    DBG("MyCCDialog::onSessionStart");
    
    AmB2BCallerSession::onSessionStart(req);

    setInOut(&playlist, &playlist);
    addToPlaylist(MyCCFactory::InitialAnnouncement);

    setDtmfDetectionEnabled(true);
}
void ConferenceDialog::setupAudio()
{
  if(!ConferenceFactory::JoinSound.empty()) {
	
    JoinSound.reset(new AmAudioFile());
    if(JoinSound->open(ConferenceFactory::JoinSound,
		       AmAudioFile::Read))
      JoinSound.reset(0);
  }

  if(!ConferenceFactory::DropSound.empty()) {
	
    DropSound.reset(new AmAudioFile());
    if(DropSound->open(ConferenceFactory::DropSound,
		       AmAudioFile::Read))
      DropSound.reset(0);
  }


  play_list.close();// !!!

  if(dialout_channel.get()){

    DBG("adding dialout_channel to the playlist (dialedout = %i)\n",dialedout);
    play_list.addToPlaylist(new AmPlaylistItem(dialout_channel.get(),
					       dialout_channel.get()));
  }
  else {

    channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag()));

    play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
					       channel.get()));
  }

  setInOut(&play_list,&play_list);
    
  setCallgroup(conf_id);
  
  MONITORING_LOG(getLocalTag().c_str(), "conf_id", conf_id.c_str());
	
  if(dialedout || !allow_dialout) {
    DBG("Dialout not enabled or dialout channel. Disabling DTMF detection.\n");
    setDtmfDetectionEnabled(false);
  }
}
Beispiel #7
0
VoiceboxDialog::VoiceboxDialog(const string& user,
			       const string& domain,
			       const string& pin, 
			       AmPromptCollection* prompts,
			       PromptOptions prompt_options)
  : user(user), domain(domain), pin(pin),
    prompts(prompts), prompt_options(prompt_options), 
    play_list(this),
    userdir_open(false), in_saved_msgs(false),
    do_save_cur_msg(false)
{
  setDtmfDetectionEnabled(true);
  msg_storage = VoiceboxFactory::MessageStorage->getInstance();
  if(!msg_storage){
    ERROR("could not get a message storage reference\n");
    throw AmSession::Exception(500,"could not get a message storage reference");
  }
}
void AnswerMachineDialog::onSessionStart(const AmSipRequest& req)
{
  // disable DTMF detection - don't use DTMF here
  setDtmfDetectionEnabled(false);

#ifdef USE_MYSQL
  string beep_file;
  if (!get_audio_file(BEEP_SOUND, "", "", "", &beep_file) ||
      beep_file.empty())
    throw string("AnswerMachine: could not find beep file\n");
  if (a_greeting.open(announce_file.c_str(),AmAudioFile::Read) ||
      a_beep.open(beep_file,AmAudioFile::Read))
    throw string("AnswerMachine: could not open greeting or beep file\n");
#else
  if (a_greeting.open(announce_file.c_str(),AmAudioFile::Read) ||
      a_beep.open(add2path(AnswerMachineFactory::AnnouncePath,1, "beep.wav"),AmAudioFile::Read))
    throw string("AnswerMachine: could not open annoucement files\n");
#endif

  msg_filename = "/tmp/" + getLocalTag() + "."
    + AnswerMachineFactory::RecFileExt;
    
  if(a_msg.open(msg_filename,AmAudioFile::Write,true))
    throw string("AnswerMachine: couldn't open ") + 
      msg_filename + string(" for writing");

  //a_msg.setRecordTime(AnswerMachineFactory::MaxRecordTime*1000);
    
  playlist.addToPlaylist(new AmPlaylistItem(&a_greeting,NULL));
  playlist.addToPlaylist(new AmPlaylistItem(&a_beep,NULL));
  //playlist.addToPlaylist(new AmPlaylistItem(NULL,&a_msg));

  setInOut(&playlist,&playlist);

  request2dict(req);
}
void AnswerMachineDialog::onSessionStart(const AmSipRequest& req)
{
  // disable DTMF detection - don't use DTMF here
  setDtmfDetectionEnabled(false);

  // announcement mode - no receiving needed
  if (MODE_ANN == vm_mode)
    setReceiving(false);

#ifdef USE_MYSQL
  string beep_file;
  if (!get_audio_file(BEEP_SOUND, "", "", "", &beep_file) ||
      beep_file.empty())
    throw string("AnswerMachine: could not find beep file\n");

  if (announce_fp) {
    rewind(announce_fp);
    if (a_greeting.fpopen(DEFAULT_TYPE"."DEFAULT_AUDIO_EXT, 
			  AmAudioFile::Read, announce_fp) ||
	a_beep.open(beep_file,AmAudioFile::Read)) {
      if (a_greeting.open(announce_file.c_str(),AmAudioFile::Read) ||
	a_beep.open(beep_file,AmAudioFile::Read))
      throw string("AnswerMachine: could not open greeting or beep file\n");
    }
  } else {
    if (a_greeting.open(announce_file.c_str(),AmAudioFile::Read) ||
	a_beep.open(beep_file,AmAudioFile::Read))
      throw string("AnswerMachine: could not open greeting or beep file\n");
  }
#else
  if (announce_fp) {
    if (a_greeting.fpopen(DEFAULT_TYPE"."DEFAULT_AUDIO_EXT, 
			  AmAudioFile::Read, announce_fp) ||
	a_beep.open(add2path(AnswerMachineFactory::AnnouncePath,1, "beep.wav"),
		    AmAudioFile::Read))
      throw string("AnswerMachine: could not open annoucement files\n");
  } else {
    if (a_greeting.open(announce_file.c_str(),AmAudioFile::Read) ||
	a_beep.open(add2path(AnswerMachineFactory::AnnouncePath,1, "beep.wav"),
		    AmAudioFile::Read))
      throw string("AnswerMachine: could not open annoucement files\n");
  }
#endif

  msg_filename = "/tmp/" + getLocalTag() + "."
    + AnswerMachineFactory::RecFileExt;
    
  if (vm_mode != MODE_ANN) {
    if(a_msg.open(msg_filename,AmAudioFile::Write,true))
      throw string("AnswerMachine: couldn't open ") + 
	msg_filename + string(" for writing");
  }

  //a_msg.setRecordTime(AnswerMachineFactory::MaxRecordTime*1000);
    
  playlist.addToPlaylist(new AmPlaylistItem(&a_greeting,NULL));
  if (vm_mode != MODE_ANN) 
    playlist.addToPlaylist(new AmPlaylistItem(&a_beep,NULL));
  //playlist.addToPlaylist(new AmPlaylistItem(NULL,&a_msg));

  setInOut(&playlist,&playlist);

  char now[15];
  sprintf(now, "%d", (int) time(NULL));
  email_dict["ts"] = now;

}