Hi everyone,
I've been able to compile the ESL wrapper for Ruby 1.9.2, however,
I'm getting an abnormal behavior with a small script (100%
functional with Ruby 1.8.7) which basically opens an ESL socket
connection and listens to channel events:
The event loop looks like the following:
con = ESL::ESLconnection.new('localhost', '8021', 'ClueCon')
con.events('plain', 'CHANNEL_ANSWER CHANNEL_HANGUP_COMPLETE
CHANNEL_BRIDGE CHANNEL_EXECUTE_COMPLETE')
i = 0
EM.run do
while (con.connected)
e = con.recvEvent()
EM.defer do
if (!e.nil? &&
!e.getHeader("variable_medularis_uuid").nil? &&
!e.getHeader("variable_clicktocall").nil?)
on_event(e, con, i)
i = i + 1
end
end
end
The problem I'm experiencing is that the event loop seems to be
reading events from the socket out of sync. For example, when I
answer a call, nothing happens (i.e. no event is processed),
however, when I hangup, the CHANNEL_ANSWER event is read from the
socket. As you can see, I'm using EventMachine, however, I've also
tried Ruby threads and I'm getting the same behavior.
Any clues on this issue? Has anyone tried Ruby 1.9.2 successfully
with ESL?
Thanks!
Best,
--
Claudio Álvarez, Ph.D.
Arquitecto de Sistemas / Systems Architect
Medularis S.p.A. - ClickFono
Tel: 56 2 934 40 74
Cel: 56 9 9079 4951
claudio@clickfono.com