void C2DCallerDialog::onSessionStart(const AmSipReply& rep) { setReceiving(false); invite_req.body = rep.body; if(wav_file.open(filename,AmAudioFile::Read)) throw string("AnnouncementDialog::onSessionStart: Cannot open file\n"); setOutput(&wav_file); }
void AnnouncementDialog::startSession(){ // 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"); setOutput(&wav_file); }
void DSMCall::startSession(){ engine.runEvent(this, this, DSMCondition::SessionStart, NULL); setReceiving(true); if (!checkVar(DSM_CONNECT_SESSION, DSM_CONNECT_SESSION_FALSE)) { if (!getInput()) setInput(&playlist); setOutput(&playlist); } }
void EarlyAnnounceDialog::onSessionStart(const AmSipRequest& req) { // we can drop all received packets // this disables DTMF detection as well setReceiving(false); DBG("EarlyAnnounceDialog::onSessionStart\n"); if(wav_file.open(filename,AmAudioFile::Read)) throw string("EarlyAnnounceDialog::onSessionStart: Cannot open file\n"); setOutput(&wav_file); }
void AnnounceCallerDialog::onSessionStart(const AmSipRequest& req) { // we can drop all received packets // this disables DTMF detection as well setReceiving(false); callee_addr = req.to; callee_uri = req.r_uri; AmB2BCallerSession::onSessionStart(req); if(wav_file.open(filename,AmAudioFile::Read)) throw string("AnnouncementDialog::onSessionStart: Cannot open file\n"); setOutput(&wav_file); }
void CallTimerDialog::onInvite(const AmSipRequest& req) { if (dlg.getStatus() == AmSipDialog::Connected) { DBG("not acting on re-Invite\n"); return; } setReceiving(false); AmMediaProcessor::instance()->removeSession(this); m_state = BB_Dialing; if(dlg.reply(req, 100, "Trying") != 0) { throw AmSession::Exception(500,"Failed to reply 100"); } invite_req = req; size_t pos1, pos2, hdr_start; // remove P-App-Name, P-App-Param header if (findHeader(invite_req.hdrs,PARAM_HDR, pos1, pos2, hdr_start)) { while (invite_req.hdrs[pos2]=='\r' ||invite_req.hdrs[pos2]=='\n') pos2++; hdr_start -= 11; //"P-App-Param" invite_req.hdrs.erase(hdr_start, pos2-hdr_start); } if (findHeader(invite_req.hdrs,"P-App-Name", pos1, pos2, hdr_start)) { while (invite_req.hdrs[pos2]=='\r' ||invite_req.hdrs[pos2]=='\n') pos2++; hdr_start -= 10; //"P-App-Name" invite_req.hdrs.erase(hdr_start, pos2-hdr_start); } dlg.updateStatus(invite_req); recvd_req.insert(std::make_pair(invite_req.cseq,invite_req)); set_sip_relay_only(true); connectCallee(invite_req.to, invite_req.r_uri, true); }
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; }