It has not made a difference when I used the playback_terminators .
My problem happens when the code gets to the while loop, this is past the playback command.
As can been seen from the debug log the code does go into the while loop and waits for events it catches all events apart from dtmf. It seems the detection of dtmf events is not happening after the
playback command
[DEBUG] src/esl.c:1042 esl_recv_event() RECV MESSAGE Event-Name: SOCKET_DATA Content-Length: 5015 Content-Type: text/event-plain
got event test event wait for event
The full test script:
require 'rubygems' require "ESL" require 'socket' include
Socket::Constants
#Log ESL::eslSetLogLevel(7)
@ring_ring = "tone_stream://%(400,200,400,450);%(400,2200,400,450);loops=2"
def pick_up_call @con.execute("answer") @con.setEventLock("true") @con.execute("sleep", "1000") @con.execute("playback", @ring_ring) end
bind_address = "127.0.0.1" bind_port = 8084
socket = Socket.new(AF_INET, SOCK_STREAM, 0) sockaddr = Socket.sockaddr_in(bind_port, bind_address) socket.bind(sockaddr) socket.listen(5)
puts "Listening for connections on #{bind_address}:#{bind_port}" loop do client_socket, client_sockaddr = socket.accept pid = fork do @con =
ESL::ESLconnection.new(client_socket.fileno) info = @con.getInfo @uuid = info.getHeader("UNIQUE-ID") @con.sendRecv("myevents") @con.sendRecv("divert_events on")
pick_up_call while @con.connected puts "wait for event" e = @con.recvEvent puts "got event" if (!e.nil?) puts "test event" name = e.getHeader("Event-Name") break if name == "SERVER_DISCONNECTED"
if name == "DTMF" digit = e.getHeader("DTMF-DIGIT") duration = e.getHeader("DTMF-DURATION") puts "*** dtmf #{digit} #{duration}" end end end
puts "Connection closed" end
Process.detach(pid) end
--- On Thu, 2/9/10, Michael Collins
<msc@freeswitch.org> wrote:
From: Michael Collins <msc@freeswitch.org> Subject: Re: [Freeswitch-users] Problems getting dtmf events - code and debug now attached To: "FreeSWITCH Users Help" <freeswitch-users@lists.freeswitch.org> Date: Thursday, 2 September, 2010, 18:54
-----Inline Attachment Follows-----
|
|