<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">I have this code below in which I want to receive and extract dtmf events.<br>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.<br><br>Another issue happening at this point when I press any digit 0-9 on the phone it is not getting an incoming dtmf events<br><br><br><br>while @con.connected<br>&nbsp;&nbsp;&nbsp; #debug&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; puts "start loop" <br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; #no digits<br>&nbsp;&nbsp;&nbsp; if dtmfbuffer.length == 0<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; e = @con.recvEventTimed(response_timeout)<br>&nbsp;&nbsp;&nbsp; # there are digits<br>&nbsp;&nbsp;&nbsp; elsif dtmfbuffer.length &gt; 0<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; e =
 @con.recvEventTimed(interdigit_timeout)<br>&nbsp;&nbsp;&nbsp; end<br><br><br>&nbsp;&nbsp;&nbsp; if e<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; name = e.getHeader("Event-Name")<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; puts "#{name}"<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break if name == "SERVER_DISCONNECTED"<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if name == "DTMF"<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; digit = e.getHeader("DTMF-Digit")<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; duration = e.getHeader("DTMF-Duration")&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; dtmfbuffer &lt;&lt; digit<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; puts "*** Dtmf #{digit} dur:#{duration} from #{@cli}"<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; end<br>&nbsp;&nbsp;&nbsp; end<br><br>&nbsp;&nbsp;&nbsp; if dtmfbuffer.length &gt; 9<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 break<br>&nbsp;&nbsp;&nbsp; end<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #debug<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; puts "end loop"<br>end<br></td></tr></table><br>