|
|
|
|
@ -33,6 +33,7 @@
|
|
|
|
|
|
|
|
|
|
#include "DSMSession.h"
|
|
|
|
|
#include "AmSession.h"
|
|
|
|
|
#include "AmPlaylist.h"
|
|
|
|
|
|
|
|
|
|
SC_EXPORT(MOD_CLS_NAME);
|
|
|
|
|
|
|
|
|
|
@ -48,6 +49,8 @@ MOD_ACTIONEXPORT_BEGIN(MOD_CLS_NAME) {
|
|
|
|
|
DEF_CMD("utils.sub", SCUSSubAction);
|
|
|
|
|
DEF_CMD("utils.int", SCUIntAction);
|
|
|
|
|
DEF_CMD("utils.splitStringCR", SCUSplitStringAction);
|
|
|
|
|
DEF_CMD("utils.playRingTone", SCUPlayRingToneAction);
|
|
|
|
|
|
|
|
|
|
} MOD_ACTIONEXPORT_END;
|
|
|
|
|
|
|
|
|
|
MOD_CONDITIONEXPORT_NONE(MOD_CLS_NAME);
|
|
|
|
|
@ -238,3 +241,39 @@ EXEC_ACTION_START(SCUSplitStringAction) {
|
|
|
|
|
last_p = p+1;
|
|
|
|
|
}
|
|
|
|
|
} EXEC_ACTION_END;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CONST_ACTION_2P(SCUPlayRingToneAction, ',', true);
|
|
|
|
|
EXEC_ACTION_START(SCUPlayRingToneAction) {
|
|
|
|
|
|
|
|
|
|
int length = 0;
|
|
|
|
|
int rtparams[4] = {2000, 4000, 440, 480}; // US
|
|
|
|
|
string s_length = resolveVars(par1, sess, sc_sess, event_params);
|
|
|
|
|
if (!str2int(s_length, length)) {
|
|
|
|
|
WARN("could not decipher ringtone length: '%s'\n", s_length.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vector<string> r_params = explode(par2, ",");
|
|
|
|
|
for (vector<string>::iterator it=
|
|
|
|
|
r_params.begin(); it !=r_params.end(); it++) {
|
|
|
|
|
string p = resolveVars(*it, sess, sc_sess, event_params);
|
|
|
|
|
if (p.empty())
|
|
|
|
|
continue;
|
|
|
|
|
if (!str2int(p, rtparams[it-r_params.begin()])) {
|
|
|
|
|
WARN("could not decipher ringtone parameter %u: '%s', using default\n",
|
|
|
|
|
it-r_params.begin(), p.c_str());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DBG("Playing ringtone length %d, on %d, off %d, f %d, f2 %d\n",
|
|
|
|
|
length, rtparams[0], rtparams[1], rtparams[2], rtparams[3]);
|
|
|
|
|
|
|
|
|
|
DSMRingTone* rt = new DSMRingTone(length, rtparams[0], rtparams[1],
|
|
|
|
|
rtparams[2], rtparams[3]);
|
|
|
|
|
sc_sess->addToPlaylist(new AmPlaylistItem(rt, NULL));
|
|
|
|
|
|
|
|
|
|
sc_sess->transferOwnership(rt);
|
|
|
|
|
} EXEC_ACTION_END;
|
|
|
|
|
|