You also could probably do session.execute("sleep", "2000");<br>But a beep is a more logical indication of when you can start recording.<br><br>I would not avoid phrase macros, they were designed to make ivr more flexible and easy to design.<br>
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.<br><br>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.<br>
<br><br><div class="gmail_quote">On Thu, Apr 10, 2008 at 9:30 PM, Chris Danielson <<a href="mailto:chris@maxpowersoft.com">chris@maxpowersoft.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
After debugging and fiddling with this further I discovered something of<br>
a useful workaround. Here it is. (works every time)<br>
<div class="Ih2E3d"><br>
while (session.ready() && dtmf.indexOf("#") < 0) {<br>
</div> sayphrase("sayit", "Say something after the tone and press pound.");<br>
var tts = new TeleTone(session);<br>
<br>
tts.generate("v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)");<br>
session.recordFile(FILELOC+filename,on_record_file,"",30,500,10);<br>
}<br>
<br>
The catch is to trick the user into letting the speech engine catch up<br>
by signaling when it is ready. BTW, are there any plans of integrating<br>
something of a memcache (I know supjigator was researching it)?<br>
<br>
As-is every time a phrase is executed a call is made to the speech<br>
engine switch_ivr_phrase_macro(...) and that call invokes a huge amount<br>
of iteration across the xml elements. For testing, I did minimize the<br>
amount of iterations and found no significant difference in the time<br>
that the phrases stopped and the recording began. I suppose the better<br>
way of doing things is to avoid using phrase macros and stick<br>
predominantly to pre-recorded sound files.<br>
Cheers,<br>
<font color="#888888">Chris<br>
</font><div><div></div><div class="Wj3C7c"><br>
<br>
Chris Danielson wrote:<br>
> The following code seems to always perform the session.recordFile(...)<br>
> function late. And this leads to cutting off the first second of the<br>
> recording. The problem goes away when you remove the<br>
> session.execute("phrase","...") call. I even ran FreeSWITCH with the<br>
> "-hp" mode to see if that changed things. No luck. Any ideas on what I<br>
> can do other than setup a pre-recorded message to play?<br>
> Cheers,<br>
> Chris<br>
><br>
> /*<br>
> <macro name="sayit"><br>
> <input pattern="(.*)"><br>
> <match><br>
> <action function="speak-text" data="$1"/><br>
> </match><br>
> </input><br>
> </macro><br>
> */<br>
><br>
> function on_record_file(sess, type, obj, arg) {<br>
> try {<br>
> if (type=="dtmf") {<br>
> dtmf += obj.digit;<br>
> if (dtmf.indexOf("#") > -1) return false;<br>
> }<br>
> } catch (e) {<br>
> console_log("error: " + e + "\n");<br>
> }<br>
> return true;<br>
> }<br>
><br>
> var dtmf = "";<br>
> var FILELOC = "/var/sounds/";<br>
> var filename = session.uuid+".wav";<br>
> while (session.ready() && dtmf.indexOf("#") < 0) {<br>
> session.execute("phrase", "sayit, Your life is a joke say something<br>
> and press pound.");<br>
> session.recordFile(FILELOC+filename,on_record_file,"",30,800,10);<br>
> }<br>
><br>
><br>
><br>
> _______________________________________________<br>
> Freeswitch-users mailing list<br>
> <a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
> <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
><br>
><br>
<br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
<br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400