[Freeswitch-users] session.recordFile issue when used right after "phrase" application
Chris Danielson
chris at maxpowersoft.com
Thu Apr 10 18:45:25 PDT 2008
The following code seems to always perform the session.recordFile(...)
function late. And this leads to cutting off the first second of the
recording. The problem goes away when you remove the
session.execute("phrase","...") call. I even ran FreeSWITCH with the
"-hp" mode to see if that changed things. No luck. Any ideas on what I
can do other than setup a pre-recorded message to play?
Cheers,
Chris
/*
<macro name="sayit">
<input pattern="(.*)">
<match>
<action function="speak-text" data="$1"/>
</match>
</input>
</macro>
*/
function on_record_file(sess, type, obj, arg) {
try {
if (type=="dtmf") {
dtmf += obj.digit;
if (dtmf.indexOf("#") > -1) return false;
}
} catch (e) {
console_log("error: " + e + "\n");
}
return true;
}
var dtmf = "";
var FILELOC = "/var/sounds/";
var filename = session.uuid+".wav";
while (session.ready() && dtmf.indexOf("#") < 0) {
session.execute("phrase", "sayit, Your life is a joke say something
and press pound.");
session.recordFile(FILELOC+filename,on_record_file,"",30,800,10);
}
More information about the FreeSWITCH-users
mailing list