[Freeswitch-users] Problems getting dtmf events - code and debug now attached
Nigel Kent
ktngl at yahoo.co.uk
Thu Sep 2 12:35:40 PDT 2010
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 at freeswitch.org> wrote:
From: Michael Collins <msc at freeswitch.org>
Subject: Re: [Freeswitch-users] Problems getting dtmf events - code and debug now attached
To: "FreeSWITCH Users Help" <freeswitch-users at lists.freeswitch.org>
Date: Thursday, 2 September, 2010, 18:54
Did you do this?
http://wiki.freeswitch.org/wiki/Channel_Variables#playback_terminators
-MC
On Thu, Sep 2, 2010 at 6:26 AM, Nigel Kent <ktngl at yahoo.co.uk> wrote:
code below and debug log now attached. It seems once playback file is played no further dtmf events come through? Any ideas!
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
--- On Wed, 1/9/10, Nigel Kent <ktngl at yahoo.co.uk> wrote:
From: Nigel Kent <ktngl at yahoo.co.uk>
Subject: [Freeswitch-users] Problems getting dtmf events
To:
freeswitch-users at lists.freeswitch.org
Date: Wednesday, 1 September, 2010, 21:15
I am trying to catch dtmf events but am having problems. It seems no dtmfs are being recieved. I can filter to other events and it gets picked up so this section of the code is doing the indented action of getting events.
However I notice that during the execution of the playback command while the sound file is playing if a key press is done at this time the dtmf does get received.
So my thought are what conditions does the playback command set in order to be able to have dtmf get recognized.
-----Inline Attachment Follows-----
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users at 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 at 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 at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100902/c6005f2e/attachment-0001.html
More information about the FreeSWITCH-users
mailing list