[Freeswitch-users] session.recordFile issue when used right after "phrase" application
Chris Danielson
chris at maxpowersoft.com
Thu Apr 10 19:30:19 PDT 2008
After debugging and fiddling with this further I discovered something of
a useful workaround. Here it is. (works every time)
while (session.ready() && dtmf.indexOf("#") < 0) {
sayphrase("sayit", "Say something after the tone and press pound.");
var tts = new TeleTone(session);
tts.generate("v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)");
session.recordFile(FILELOC+filename,on_record_file,"",30,500,10);
}
The catch is to trick the user into letting the speech engine catch up
by signaling when it is ready. BTW, are there any plans of integrating
something of a memcache (I know supjigator was researching it)?
As-is every time a phrase is executed a call is made to the speech
engine switch_ivr_phrase_macro(...) and that call invokes a huge amount
of iteration across the xml elements. For testing, I did minimize the
amount of iterations and found no significant difference in the time
that the phrases stopped and the recording began. I suppose the better
way of doing things is to avoid using phrase macros and stick
predominantly to pre-recorded sound files.
Cheers,
Chris
Chris Danielson wrote:
> 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);
> }
>
>
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
More information about the FreeSWITCH-users
mailing list