FYI,<br><br>This issue was discussed on IRC and consuming events is absolutely not what the OP needs. Tony gave him some great information on using session:getDigits and setInputCallback so that he doesn't have to block audio while messing with the events. <br>
<br>-MC<br><br><div class="gmail_quote">On Thu, Apr 5, 2012 at 2:03 PM, grmt <span dir="ltr"><<a href="mailto:garmt.noname@gmail.com">garmt.noname@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What version of FS are you running? You need a fairly recent version of FS to support the timeout parameter of con:pop<br>
<br>
Pop(1,5) means block and wait, but only 0.05 (s)<br>
Is that what you want? I guess not, you usually don't want to block a lua script that handles audio.<br>
And you certainly don't want to repeat this "blocking" 20 times per sec, polling for DTMF events<br>
<br>
There are better ways to catch DTMF (setInputCallback ...)<br>
<br>
( I think anthm answered you on IRC..)<br>
-----Original Message-----<br>
From: <a href="mailto:freeswitch-dev-bounces@lists.freeswitch.org">freeswitch-dev-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-dev-bounces@lists.freeswitch.org">freeswitch-dev-bounces@lists.freeswitch.org</a>] On Behalf Of adam harris<br>
Sent: Wednesday, April 04, 2012 03:26<br>
To: <a href="mailto:freeswitch-dev@lists.freeswitch.org">freeswitch-dev@lists.freeswitch.org</a><br>
Subject: [Freeswitch-dev] error in con:pop wrong number of args<br>
<br>
I am getting this error from the test code below. I have used 2 arguments but it is picking up 3?<br>
<br>
<br>
2012-04-03 21:16:08.583714 [ERR] mod_lua.cpp:191 Error in pop expected 1..2 args, got 3 stack traceback:<br>
[C]: in function 'pop'<br>
/usr/local/freeswitch/scripts/aprompt.lua:21: in function '(for generator)'<br>
/usr/local/freeswitch/scripts/aprompt.lua:21: in main chunk<br>
<br>
<br>
---------------------------------------------------<br>
<br>
dtmfbuffer = ""<br>
<br>
con = freeswitch.EventConsumer("DTMF")<br>
<br>
session:setVariable("playback_terminators", "0123456789") session:execute("playback", "sound/test.wav")<br>
<br>
<br>
while ((session:ready() == true)) do<br>
<br>
<br>
for e in (function() return con:pop(1,5) end) do<br>
<br>
event_name = e:getHeader("Event-Name") or ""<br>
<br>
if (event_name == "DTMF") then<br>
<br>
print(dtmfbuffer)<br>
end<br>
<br>
end<br>
<br>
end<br>
<br>
session:hangup()<br>
<br>
<br>
<br>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server <a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br>