I have this code below in which I want to receive and extract dtmf events. It seems all previous events are queued and received together at this point as the while loop is run. I don't know why it does this I only need the current events to be received. Another issue happening at this point when I press any digit 0-9 on the phone it is not getting an incoming dtmf events while @con.connected #debug puts "start loop" #no digits if dtmfbuffer.length == 0 e = @con.recvEventTimed(response_timeout) # there are digits elsif dtmfbuffer.length > 0 e = @con.recvEventTimed(interdigit_timeout) end if e name = e.getHeader("Event-Name") puts "#{name}" break if name == "SERVER_DISCONNECTED" if name == "DTMF" digit = e.getHeader("DTMF-Digit") duration = e.getHeader("DTMF-Duration") dtmfbuffer << digit puts "*** Dtmf #{digit} dur:#{duration} from #{@cli}" end end if dtmfbuffer.length > 9 break end #debug puts "end loop" end
What integer values are in response_timeout and interdigit_timeout? Just curious, because if they are too large then it will indeed block while waiting for events. -MC On Mon, Aug 30, 2010 at 4:34 PM, Nigel Kent <ktngl@yahoo.co.uk> wrote:
I have this code below in which I want to receive and extract dtmf events. It seems all previous events are queued and received together at this point as the while loop is run. I don't know why it does this I only need the current events to be received.
Another issue happening at this point when I press any digit 0-9 on the phone it is not getting an incoming dtmf events
while @con.connected #debug puts "start loop"
#no digits if dtmfbuffer.length == 0 e = @con.recvEventTimed(response_timeout) # there are digits elsif dtmfbuffer.length > 0 e = @con.recvEventTimed(interdigit_timeout) end
if e name = e.getHeader("Event-Name") puts "#{name}" break if name == "SERVER_DISCONNECTED" if name == "DTMF" digit = e.getHeader("DTMF-Digit") duration = e.getHeader("DTMF-Duration") dtmfbuffer << digit puts "*** Dtmf #{digit} dur:#{duration} from #{@cli}" end end
if dtmfbuffer.length > 9 break end #debug puts "end loop" end
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
# time out and inter digit time out response_timeout = (20 * 1000) interdigit_timeout = (10 * 1000) --- On Tue, 31/8/10, Michael Collins <msc@freeswitch.org> wrote: From: Michael Collins <msc@freeswitch.org> Subject: Re: [Freeswitch-users] recvEvent in ruby To: "FreeSWITCH Users Help" <freeswitch-users@lists.freeswitch.org> Date: Tuesday, 31 August, 2010, 0:13 What integer values are in response_timeout and interdigit_timeout? Just curious, because if they are too large then it will indeed block while waiting for events. -MC On Mon, Aug 30, 2010 at 4:34 PM, Nigel Kent <ktngl@yahoo.co.uk> wrote: I have this code below in which I want to receive and extract dtmf events. It seems all previous events are queued and received together at this point as the while loop is run. I don't know why it does this I only need the current events to be received. Another issue happening at this point when I press any digit 0-9 on the phone it is not getting an incoming dtmf events while @con.connected #debug puts "start loop" #no digits if dtmfbuffer.length == 0 e = @con.recvEventTimed(response_timeout) # there are digits elsif dtmfbuffer.length > 0 e = @con.recvEventTimed(interdigit_timeout) end if e name = e.getHeader("Event-Name") puts "#{name}" break if name == "SERVER_DISCONNECTED" if name == "DTMF" digit = e.getHeader("DTMF-Digit") duration = e.getHeader("DTMF-Duration") dtmfbuffer << digit puts "*** Dtmf #{digit} dur:#{duration} from #{@cli}" end end if dtmfbuffer.length > 9 break end #debug puts "end loop" end _______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -----Inline Attachment Follows----- _______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
On Mon, Aug 30, 2010 at 5:24 PM, Nigel Kent <ktngl@yahoo.co.uk> wrote:
# time out and inter digit time out response_timeout = (20 * 1000) interdigit_timeout = (10 * 1000)
According to page 224 of the handy dandy bridge book :) the recvEventTimed method accepts milliseconds as its argument. So... it looks like you are blocking for 20 seconds and 10 seconds on these two values. I'm assuming that you don't want to block for that long? -MC
--- On *Tue, 31/8/10, Michael Collins <msc@freeswitch.org>* wrote:
From: Michael Collins <msc@freeswitch.org> Subject: Re: [Freeswitch-users] recvEvent in ruby To: "FreeSWITCH Users Help" <freeswitch-users@lists.freeswitch.org> Date: Tuesday, 31 August, 2010, 0:13
What integer values are in response_timeout and interdigit_timeout? Just curious, because if they are too large then it will indeed block while waiting for events. -MC
On Mon, Aug 30, 2010 at 4:34 PM, Nigel Kent <ktngl@yahoo.co.uk<http://mc/compose?to=ktngl@yahoo.co.uk>
wrote:
I have this code below in which I want to receive and extract dtmf events. It seems all previous events are queued and received together at this point as the while loop is run. I don't know why it does this I only need the current events to be received.
Another issue happening at this point when I press any digit 0-9 on the phone it is not getting an incoming dtmf events
while @con.connected #debug puts "start loop"
#no digits if dtmfbuffer.length == 0 e = @con.recvEventTimed(response_timeout) # there are digits elsif dtmfbuffer.length > 0 e = @con.recvEventTimed(interdigit_timeout) end
if e name = e.getHeader("Event-Name") puts "#{name}" break if name == "SERVER_DISCONNECTED" if name == "DTMF" digit = e.getHeader("DTMF-Digit") duration = e.getHeader("DTMF-Duration") dtmfbuffer << digit puts "*** Dtmf #{digit} dur:#{duration} from #{@cli}" end end
if dtmfbuffer.length > 9 break end #debug puts "end loop" end
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org<http://mc/compose?to=FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-----Inline Attachment Follows-----
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org<http://mc/compose?to=FreeSWITCH-users@lists.freeswitch.org> 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 FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
Michael Collins
-
Nigel Kent