use default prompts if no domain/language specific found

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

@ -69,7 +69,7 @@ AmPromptCollection* VoiceboxFactory::getPrompts(const string& domain,
map<string, AmPromptCollection*>::iterator l_it = d_it->second.find(language);
if (l_it != d_it->second.end()) {
// get the optios to the dom/lang combination
// get the options to the dom/lang combination
po = PromptOptions(false, false);
map<string, map<string, PromptOptions> >::iterator d_oit =
prompt_options.find(domain);
@ -85,6 +85,21 @@ AmPromptCollection* VoiceboxFactory::getPrompts(const string& domain,
return NULL;
}
AmPromptCollection* VoiceboxFactory::findPrompts(const string& domain,
const string& language,
PromptOptions& po) {
AmPromptCollection* res = getPrompts(domain, language, po);
if (res) return res;
// best hit:
if ((res = getPrompts(domain, default_language, po))!=NULL) return res;
if ((res = getPrompts(domain, "", po))!=NULL) return res;
if ((res = getPrompts("", language, po))!=NULL) return res;
if ((res = getPrompts("", default_language, po))!=NULL) return res;
return getPrompts("", "", po);
}
AmPromptCollection* VoiceboxFactory::loadPrompts(string prompt_base_path,
string domain, string language,
bool load_digits) {
@ -301,7 +316,7 @@ AmSession* VoiceboxFactory::onInvite(const AmSipRequest& req)
language = default_language;
PromptOptions po(false, false);
AmPromptCollection* pc = getPrompts(domain, language, po);
AmPromptCollection* pc = findPrompts(domain, language, po);
if (NULL == pc)
throw AmSession::Exception(500, APP_NAME ": no menu for domain/language");

@ -49,6 +49,12 @@ class VoiceboxFactory
AmPromptCollection* getPrompts(const string& domain, const string& language,
PromptOptions& po);
/** finds prompts from specific to default prompts */
AmPromptCollection* findPrompts(const string& domain,
const string& language,
PromptOptions& po);
AmPromptCollection* loadPrompts(string prompt_base_path,
string domain, string language,
bool load_digits);

Loading…
Cancel
Save