[Freeswitch-dev] error in con:pop wrong number of args

Michael Collins msc at freeswitch.org
Fri Apr 6 01:56:04 MSD 2012


FYI,

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.

-MC

On Thu, Apr 5, 2012 at 2:03 PM, grmt <garmt.noname at gmail.com> wrote:

> What version of FS are you running? You need a fairly recent version of FS
> to support the timeout parameter of con:pop
>
> Pop(1,5) means block and wait,  but only 0.05 (s)
> Is that what you want?  I guess not, you usually don't want to block a lua
> script that handles audio.
> And you certainly don't want to repeat this "blocking" 20 times per sec,
> polling for DTMF events
>
> There are better ways to catch DTMF (setInputCallback  ...)
>
> ( I think anthm answered you on IRC..)
> -----Original Message-----
> From: freeswitch-dev-bounces at lists.freeswitch.org [mailto:
> freeswitch-dev-bounces at lists.freeswitch.org] On Behalf Of adam harris
> Sent: Wednesday, April 04, 2012 03:26
> To: freeswitch-dev at lists.freeswitch.org
> Subject: [Freeswitch-dev] error in con:pop wrong number of args
>
> I am getting this error from the test code below. I have used 2 arguments
> but it is picking up 3?
>
>
> 2012-04-03 21:16:08.583714 [ERR] mod_lua.cpp:191 Error in pop expected
> 1..2 args, got 3 stack traceback:
>        [C]: in function 'pop'
>        /usr/local/freeswitch/scripts/aprompt.lua:21: in function '(for
> generator)'
>        /usr/local/freeswitch/scripts/aprompt.lua:21: in main chunk
>
>
> ---------------------------------------------------
>
> dtmfbuffer = ""
>
> con = freeswitch.EventConsumer("DTMF")
>
> session:setVariable("playback_terminators", "0123456789")
> session:execute("playback", "sound/test.wav")
>
>
> while ((session:ready() == true)) do
>
>
>  for e in (function() return con:pop(1,5) end) do
>
>  event_name = e:getHeader("Event-Name") or ""
>
>  if (event_name == "DTMF") then
>
>  print(dtmfbuffer)
>  end
>
>  end
>
> end
>
> session:hangup()
>
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20120405/36ecf741/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list