Load console command in daemon mode or reload a modified call controller without restarting Adhearsion

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

Load console command in daemon mode or reload a modified call controller without restarting Adhearsion

olivier.agnus
Hello,

We use Adhearsion for multiple services that we route from a main Call Controller named dnis.rb that looks like this :

require 'call_controllers/service1'
require 'call_controllers/service2'
require 'call_controllers/service3'
require 'call_controllers/default'
class Dnis < Adhearsion::CallController
  def run
    answer
    case call.to
    when "0836"
  logger.info "Routing to Service1"
invoke Service1
      when "9511"
  logger.info "Routing to service2"
invoke Service2
    when "0853", "2159", "9398"
  logger.info "Routing to service3"
invoke Service3
else
logger.info "Routing to Default"
invoke Default
end
  end
end

So we invoke the call controller that matches the DNIS we receive.

If we have to modify service1.rb, with Adhearsion launched in foreground from the shell, it is easy to reload the modifications with the command  'load /[pathToTheCallController]/service1.rb' in the running console.

For production use, we launch Adhearsion in background from an init.d script, but in this case we have no Adhearsion console.
How can we use the 'load' command in that mode or how can we reload a modified call controller without restarting Adhearsion ?

Thanks for your feedback.
Regards

Olivier

--
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: Load console command in daemon mode or reload a modified call controller without restarting Adhearsion

Ben Langfeld-2
Hot code reloading is not supported by Adhearsion.

On Thu, 17 Dec 2015 at 18:04 <[hidden email]> wrote:
Hello,

We use Adhearsion for multiple services that we route from a main Call Controller named dnis.rb that looks like this :

require 'call_controllers/service1'
require 'call_controllers/service2'
require 'call_controllers/service3'
require 'call_controllers/default'
class Dnis < Adhearsion::CallController
  def run
    answer
    case call.to
    when "0836"
  logger.info "Routing to Service1"
invoke Service1
      when "9511"
  logger.info "Routing to service2"
invoke Service2
    when "0853", "2159", "9398"
  logger.info "Routing to service3"
invoke Service3
else
logger.info "Routing to Default"
invoke Default
end
  end
end

So we invoke the call controller that matches the DNIS we receive.

If we have to modify service1.rb, with Adhearsion launched in foreground from the shell, it is easy to reload the modifications with the command  'load /[pathToTheCallController]/service1.rb' in the running console.

For production use, we launch Adhearsion in background from an init.d script, but in this case we have no Adhearsion console.
How can we use the 'load' command in that mode or how can we reload a modified call controller without restarting Adhearsion ?

Thanks for your feedback.
Regards

Olivier

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

--
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: Load console command in daemon mode or reload a modified call controller without restarting Adhearsion

Ben Klang-2
In reply to this post by olivier.agnus
Hi Olivier,

What you’re asking for is something we’ve talked about doing, but it is unfortunately relatively complicated. As of today, there isn’t a way to do it.  It’s also worth mentioning that the method you’ve described, using `load`, isn’t particularly safe. What happens to calls that are currently executing? What happens if you make an incompatible change on a call mid-stream?  It might work for small-scale systems or development instances, but it could be dangerous on larger systems.

However, if you are interested in working on something like this, perhaps as an Adhearsion plugin, we’d be happy to talk more about how it could work.  Doing it as a plugin offers some flexibility for users who want this kind of functionality.

Hope that helps,
/BAK/
-- 
Ben Klang
Principal/Technology Strategist, Mojo Lingo
+1.404.475.4841

Mojo Lingo -- Voice applications that work like magic
Twitter: @MojoLingo

Il giorno Dec 17, 2015, alle ore 2:12 PM, [hidden email] ha scritto:

Hello,

We use Adhearsion for multiple services that we route from a main Call Controller named dnis.rb that looks like this :

require 'call_controllers/service1'
require 'call_controllers/service2'
require 'call_controllers/service3'
require 'call_controllers/default'
class Dnis < Adhearsion::CallController
  def run
    answer
    case call.to
    when "0836"
  logger.info "Routing to Service1"
invoke Service1
      when "9511"
  logger.info "Routing to service2"
invoke Service2
    when "0853", "2159", "9398"
  logger.info "Routing to service3"
invoke Service3
else
logger.info "Routing to Default"
invoke Default
end
  end
end

So we invoke the call controller that matches the DNIS we receive.

If we have to modify service1.rb, with Adhearsion launched in foreground from the shell, it is easy to reload the modifications with the command  'load /[pathToTheCallController]/service1.rb' in the running console.

For production use, we launch Adhearsion in background from an init.d script, but in this case we have no Adhearsion console.
How can we use the 'load' command in that mode or how can we reload a modified call controller without restarting Adhearsion ?

Thanks for your feedback.
Regards

Olivier

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

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

signature.asc (858 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Load console command in daemon mode or reload a modified call controller without restarting Adhearsion

olivier.agnus
In reply to this post by olivier.agnus
Hi,

Thanks you both for your quick and detailed  answers.
@Ben Kiang
You are right, we are on a small scale system, but we will use 'load' very carefully now !
We will think for developing plugin later when we will become more confident with Adhearsion.

Best regards.

Olivier
Axxès Interactive

Le jeudi 17 décembre 2015 16:04:39 UTC-4, [hidden email] a écrit :
Hello,

We use Adhearsion for multiple services that we route from a main Call Controller named dnis.rb that looks like this :

require 'call_controllers/service1'
require 'call_controllers/service2'
require 'call_controllers/service3'
require 'call_controllers/default'
class Dnis < Adhearsion::CallController
  def run
    answer
    case <a href="http://call.to" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fcall.to\46sa\75D\46sntz\0751\46usg\75AFQjCNHDFEMLI3FVcryLYAx56Xqt_xSn6g&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fcall.to\46sa\75D\46sntz\0751\46usg\75AFQjCNHDFEMLI3FVcryLYAx56Xqt_xSn6g&#39;;return true;">call.to
    when "0836"
  <a href="http://logger.info" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;">logger.info "Routing to Service1"
invoke Service1
      when "9511"
  <a href="http://logger.info" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;">logger.info "Routing to service2"
invoke Service2
    when "0853", "2159", "9398"
  <a href="http://logger.info" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;">logger.info "Routing to service3"
invoke Service3
else
<a href="http://logger.info" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;">logger.info "Routing to Default"
invoke Default
end
  end
end

So we invoke the call controller that matches the DNIS we receive.

If we have to modify service1.rb, with Adhearsion launched in foreground from the shell, it is easy to reload the modifications with the command  'load /[pathToTheCallController]/service1.rb' in the running console.

For production use, we launch Adhearsion in background from an init.d script, but in this case we have no Adhearsion console.
How can we use the 'load' command in that mode or how can we reload a modified call controller without restarting Adhearsion ?

Thanks for your feedback.
Regards

Olivier

--
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: Load console command in daemon mode or reload a modified call controller without restarting Adhearsion

Yaron Zehavi
In reply to this post by olivier.agnus
Hello,

I'm new to ruby and Adhearsion. 
I read in another place the following:
"Unlike other languages such as PHP or Ruby, Node.js requires a restart when you make changes to the source code."

So, not supporting dynamic reload of modified source code is limitation of Adhearsion in specific, or limitation of Ruby?
If Ruby supports it, is there any way of a workaround for doing so in Adhearsion?

Thanks,
Yaron 

--
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: Load console command in daemon mode or reload a modified call controller without restarting Adhearsion

Ben Langfeld-2
The problem is, Yaron, that "code reloading" is not a simple or unit thing that can either is or is not available; it is much more nuanced than that. Adhearsion does not support hot code reloading, and it is not entirely clear that it could, but there will be no definitive answers until someone spends the time to spike an implementation, which is not on the roadmap of anyone I know of.

On Tue, 19 Jan 2016 at 14:56 Yaron Zehavi <[hidden email]> wrote:
Hello,

I'm new to ruby and Adhearsion. 
I read in another place the following:
"Unlike other languages such as PHP or Ruby, Node.js requires a restart when you make changes to the source code."

So, not supporting dynamic reload of modified source code is limitation of Adhearsion in specific, or limitation of Ruby?
If Ruby supports it, is there any way of a workaround for doing so in Adhearsion?

Thanks,
Yaron 

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

--
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: Load console command in daemon mode or reload a modified call controller without restarting Adhearsion

Yaron Zehavi
In reply to this post by olivier.agnus
Thank you very much for your quick response,
Yaron

On Thursday, December 17, 2015 at 10:04:39 PM UTC+2, [hidden email] wrote:
Hello,

We use Adhearsion for multiple services that we route from a main Call Controller named dnis.rb that looks like this :

require 'call_controllers/service1'
require 'call_controllers/service2'
require 'call_controllers/service3'
require 'call_controllers/default'
class Dnis < Adhearsion::CallController
  def run
    answer
    case <a href="http://call.to" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fcall.to\46sa\75D\46sntz\0751\46usg\75AFQjCNHDFEMLI3FVcryLYAx56Xqt_xSn6g&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fcall.to\46sa\75D\46sntz\0751\46usg\75AFQjCNHDFEMLI3FVcryLYAx56Xqt_xSn6g&#39;;return true;">call.to
    when "0836"
  <a href="http://logger.info" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;">logger.info "Routing to Service1"
invoke Service1
      when "9511"
  <a href="http://logger.info" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;">logger.info "Routing to service2"
invoke Service2
    when "0853", "2159", "9398"
  <a href="http://logger.info" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;">logger.info "Routing to service3"
invoke Service3
else
<a href="http://logger.info" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Flogger.info\46sa\75D\46sntz\0751\46usg\75AFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;">logger.info "Routing to Default"
invoke Default
end
  end
end

So we invoke the call controller that matches the DNIS we receive.

If we have to modify service1.rb, with Adhearsion launched in foreground from the shell, it is easy to reload the modifications with the command  'load /[pathToTheCallController]/service1.rb' in the running console.

For production use, we launch Adhearsion in background from an init.d script, but in this case we have no Adhearsion console.
How can we use the 'load' command in that mode or how can we reload a modified call controller without restarting Adhearsion ?

Thanks for your feedback.
Regards

Olivier

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