[Freeswitch-users] recvEvent in ruby
Nigel Kent
ktngl at yahoo.co.uk
Mon Aug 30 16:34:12 PDT 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100830/1037b863/attachment.html
More information about the FreeSWITCH-users
mailing list