diff --git a/apps/dsm/DSMCoreModule.cpp b/apps/dsm/DSMCoreModule.cpp index 1d71e8f2..7d88f3e3 100644 --- a/apps/dsm/DSMCoreModule.cpp +++ b/apps/dsm/DSMCoreModule.cpp @@ -64,6 +64,7 @@ DSMAction* DSMCoreModule::getAction(const string& from_str) { DEF_CMD("disableDTMFDetection", SCDisableDTMFDetection); DEF_CMD("set", SCSetAction); + DEF_CMD("setVar", SCSetVarAction); DEF_CMD("var", SCGetVarAction); DEF_CMD("append", SCAppendAction); DEF_CMD("substr", SCSubStrAction); @@ -332,6 +333,15 @@ EXEC_ACTION_START(SCSetAction) { var_name.c_str(), sc_sess->var[var_name].c_str()); } EXEC_ACTION_END; +CONST_ACTION_2P(SCSetVarAction,'=', false); +EXEC_ACTION_START(SCSetVarAction) { + string var_name = resolveVars(par1, sess, sc_sess, event_params); + sc_sess->var[var_name] = resolveVars(par2, sess, sc_sess, event_params); + DBG("set $%s='%s'\n", + var_name.c_str(), sc_sess->var[var_name].c_str()); +} EXEC_ACTION_END; + + CONST_ACTION_2P(SCGetVarAction,'=', false); EXEC_ACTION_START(SCGetVarAction){ string dst_var_name = (par1.length() && par1[0] == '$')? diff --git a/apps/dsm/DSMCoreModule.h b/apps/dsm/DSMCoreModule.h index 167de682..43ffdd3e 100644 --- a/apps/dsm/DSMCoreModule.h +++ b/apps/dsm/DSMCoreModule.h @@ -80,6 +80,7 @@ DEF_ACTION_2P(SCSetTimerAction); DEF_ACTION_2P(SCLogAction); DEF_ACTION_1P(SCLogVarsAction); DEF_ACTION_2P(SCGetVarAction); +DEF_ACTION_2P(SCSetVarAction); DEF_ACTION_2P(SCPlayFileAction); DEF_ACTION_2P(SCPlayFileFrontAction); DEF_ACTION_2P(SCPostEventAction);