You also could probably do session.execute("sleep", "2000");
But a beep is a more logical indication of when you can start recording.
I would not avoid phrase macros, they were designed to make ivr more
flexible and easy to design.
I think the problem is not related to performance it's a temporal issue so
the beep buys time for a lead-in on the recording.
The XML from the phrases are stored in memory and parsing them does not
become a bottleneck until about the 500 calls per second mark.
On Thu, Apr 10, 2008 at 9:30 PM, Chris Danielson <[EMAIL PROTECTED]>
wrote:
> 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
> > [email protected]
> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> > http://www.freeswitch.org
> >
> >
>
> _______________________________________________
> Freeswitch-users mailing list
> [email protected]
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
AIM: anthm
MSN:[EMAIL PROTECTED] <[EMAIL PROTECTED]>
GTALK/JABBER/PAYPAL:[EMAIL PROTECTED]<[EMAIL PROTECTED]>
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:[EMAIL PROTECTED] <[EMAIL PROTECTED]>
iax:[EMAIL PROTECTED]/888
googletalk:[EMAIL PROTECTED]<[EMAIL PROTECTED]>
pstn:213-799-1400
_______________________________________________
Freeswitch-users mailing list
[email protected]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org