From bcca72498ac961eb0e412cfeb46397443d432bdc Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Tue, 27 Jan 2009 22:26:43 +0000 Subject: [PATCH] fixed prompts fallback git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1248 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- apps/dsm/DSM.cpp | 5 ++--- apps/dsm/DSMDialog.cpp | 15 ++++++++------- apps/dsm/DSMDialog.h | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/apps/dsm/DSM.cpp b/apps/dsm/DSM.cpp index e2d1d511..bdd9a78c 100644 --- a/apps/dsm/DSM.cpp +++ b/apps/dsm/DSM.cpp @@ -242,8 +242,7 @@ AmSession* DSMFactory::onInvite(const AmSipRequest& req) } else { start_diag = req.cmd; } - - DSMDialog* s = new DSMDialog(prompts, diags, start_diag, NULL); + DSMDialog* s = new DSMDialog(&prompts, diags, start_diag, NULL); prepareSession(s); return s; } @@ -270,7 +269,7 @@ AmSession* DSMFactory::onInvite(const AmSipRequest& req, cred = dynamic_cast(cred_obj); } - DSMDialog* s = new DSMDialog(prompts, diags, start_diag, cred); + DSMDialog* s = new DSMDialog(&prompts, diags, start_diag, cred); prepareSession(s); if (NULL == cred) { diff --git a/apps/dsm/DSMDialog.cpp b/apps/dsm/DSMDialog.cpp index 763c2c64..5d4895df 100644 --- a/apps/dsm/DSMDialog.cpp +++ b/apps/dsm/DSMDialog.cpp @@ -30,7 +30,7 @@ #include "AmMediaProcessor.h" #include "DSM.h" -DSMDialog::DSMDialog(AmPromptCollection& prompts, +DSMDialog::DSMDialog(AmPromptCollection* prompts, DSMStateDiagramCollection& diags, const string& startDiagName, UACAuthCred* credentials) @@ -47,7 +47,7 @@ DSMDialog::~DSMDialog() audiofiles.begin();it!=audiofiles.end();it++) delete *it; - used_prompt_sets.insert(&prompts); + used_prompt_sets.insert(prompts); for (set::iterator it= used_prompt_sets.begin(); it != used_prompt_sets.end(); it++) (*it)->cleanup((long)this); @@ -175,14 +175,15 @@ inline UACAuthCred* DSMDialog::getCredentials() { void DSMDialog::playPrompt(const string& name, bool loop) { DBG("playing prompt '%s'\n", name.c_str()); - if (prompts.addToPlaylist(name, (long)this, playlist, + if (prompts->addToPlaylist(name, (long)this, playlist, /*front =*/ false, loop)) { if ((var["prompts.default_fallback"] != "yes") || - default_prompts.addToPlaylist(name, (long)this, playlist, + default_prompts->addToPlaylist(name, (long)this, playlist, /*front =*/ false, loop)) { + DBG("checked [%p]\n", default_prompts); SET_ERRNO(DSM_ERRNO_UNKNOWN_ARG); } else { - used_prompt_sets.insert(&default_prompts); + used_prompt_sets.insert(default_prompts); SET_ERRNO(DSM_ERRNO_OK); } } else { @@ -270,8 +271,8 @@ void DSMDialog::setPromptSet(const string& name) { } DBG("setting prompt set '%s'\n", name.c_str()); - used_prompt_sets.insert(&prompts); - prompts = *it->second; + used_prompt_sets.insert(prompts); + prompts = it->second; SET_ERRNO(DSM_ERRNO_OK); } diff --git a/apps/dsm/DSMDialog.h b/apps/dsm/DSMDialog.h index 1d2b9b59..214d5644 100644 --- a/apps/dsm/DSMDialog.h +++ b/apps/dsm/DSMDialog.h @@ -44,8 +44,8 @@ class DSMDialog : public AmSession, std::auto_ptr cred; DSMStateEngine engine; - AmPromptCollection& prompts; - AmPromptCollection& default_prompts; + AmPromptCollection* prompts; + AmPromptCollection* default_prompts; DSMStateDiagramCollection& diags; string startDiagName; AmPlaylist playlist; @@ -57,7 +57,7 @@ class DSMDialog : public AmSession, bool checkVar(const string& var_name, const string& var_val); public: - DSMDialog(AmPromptCollection& prompts, + DSMDialog(AmPromptCollection* prompts, DSMStateDiagramCollection& diags, const string& startDiagName, UACAuthCred* credentials = NULL);