void DSMCall::playPrompt(const string& name, bool loop, bool front) { DBG("playing prompt '%s'\n", name.c_str()); if (prompts->addToPlaylist(name, (long)this, playlist, front, loop)) { if ((var["prompts.default_fallback"] != "yes") || default_prompts->addToPlaylist(name, (long)this, playlist, front, loop)) { DBG("checked [%p]\n", default_prompts); throw DSMException("prompt", "name", name); } else { used_prompt_sets.insert(default_prompts); CLR_ERRNO; } } else { CLR_ERRNO; } }
static bool ConferenceJoinChannel(DSMConfChannel** dsm_chan, AmSession* sess, DSMSession* sc_sess, const string& channel_id, const string& mode) { bool connect_play = false; bool connect_record = false; if (mode.empty()) { connect_play = true; connect_record = true; } else if (mode == "speakonly") { connect_record = true; } else if (mode == "listenonly") { connect_play = true; } DBG("connect_play = %s, connect_rec = %s\n", connect_play?"true":"false", connect_record?"true":"false"); AmConferenceChannel* chan = AmConferenceStatus::getChannel(channel_id, sess->getLocalTag()); if (NULL == chan) { ERROR("obtaining conference channel\n"); throw DSMException("conference"); return false; } if (NULL != *dsm_chan) { (*dsm_chan)->reset(chan); } else { *dsm_chan = new DSMConfChannel(chan); } AmAudio* play_item = NULL; AmAudio* rec_item = NULL; if (connect_play) play_item = chan; if (connect_record) rec_item = chan; sc_sess->addToPlaylist(new AmPlaylistItem(play_item, rec_item)); return true; }
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; }