electric_slide - play before connecting calls

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

electric_slide - play before connecting calls

tal weissler
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:

def self.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



--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: electric_slide - play before connecting calls

Giorgio Bianchi
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


Il giorno martedì 9 maggio 2017 15:57:07 UTC+2, tal weissler ha scritto:
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:

def self.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



--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: electric_slide - play before connecting calls

tal weissler
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:

    call[:controller] = self

2. Then in the class where I'm adding the agents:

    agent.class.on_connect do |queue, agent, client| 
      client[:controller].play "hello-world"
    end

that did the trick for me

Thanks,
Tal


On Thursday, May 11, 2017 at 10:43:03 AM UTC+3, Giorgio Bianchi wrote:
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


Il giorno martedì 9 maggio 2017 15:57:07 UTC+2, tal weissler ha scritto:
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:

def self.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



--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.