You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Adhearsion
Hello,
I'm using electric_slide to create a queue and I would like to play something to the person about to leave the queue before he is connected to an agent.
I found the method on_connect:
on_connect: Args: [Queue, Agent Call, Client Call] Called as the agent is being connected to the client call
which is defined in agent.rb:
defself.on_connect(&block)
@connect_callback= block
end
When I try to execute agent.class.on_connect {play "hello-world"} it crashes because<NoMethodError> undefined method `play' for #<ElectricSlide::Agent:0x00000003813488>
This happens because it's being implemented with instance_exec which takes the Agent's binding and not the lexical scope.
How can I play on the call received by the callback?
Thanks,
Tal
Giorgio Bianchi
unread,
May 11, 2017, 3:43:03 AM5/11/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Adhearsion
Hi, I think you should try something like this :
agent.class.on_connect do|queue,agent_call,client_call| client_call.execute_controller do play "hello-world" end end
I don't know if this code works but the key concept is : you should execute a controller over the affected call to make it do something.
Let me know if this helps!
Giorgio
tal weissler
unread,
May 15, 2017, 10:33:38 AM5/15/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Adhearsion
Hi,
Unfortunately, when I tried that it gave me this error:
<NoMethodError> undefined method `play' for #<Celluloid::ThreadHandle:0x000000049d6cd8>
However, I did manage to solve to problem this way:
1. In the class where I'm adding callers to the queue, I added: