`active_gem_with_options': undefined method `activate'

  • Thread starter Daniel Sánchez
  • Start date
D

Daniel Sánchez

i have some problems with this
tengo algunos problemas con esto
==============================================================================
Launched AGI Script /var/lib/asterisk/agi-bin/comprobar-festivos.rb
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:66:in `active_gem_with_options':
undefined method `activate' for Gem:Module (NoMethodError)
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:59:in `require'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:75
from /var/lib/asterisk/agi-bin/comprobar-festivos.rb:17:in
`require'
from /var/lib/asterisk/agi-bin/comprobar-festivos.rb:17
-- AGI Script comprobar-festivos.rb completed, returning 0
==============================================================================

this is my script
este es mi script
==============================================================================
#!/usr/bin/env ruby


# AGI para consulta de festivos en un calendario ICalendar ubicado en
nuestro sistema de archivos.
# Licencia GPL.
# Por Iñaki Baz <[email protected]>
# Irontec: http://www.irontec.com
# Blog Voz-ip: http://blog.voz-ip.com



# Variables:
categoria_festivo = "Festivo"
archivo_calendario = "/var/www/webdav/Spain32Holidays.ics"


require 'rubygems'
require 'icalendar'
require 'date'
require_gem 'ruby-agi'


# Creamos un objeto AGI:
agi = AGI.new

# Calendario ICS:
cal_file = File.open(archivo_calendario)

# Parseamos el fichero:
cals = Icalendar.parse(cal_file)

# "cals" es en realidad un array pues pueden haber varios calendarios en
un fichero ICS. Nos quedamos con el primero (que es el único):
cal = cals.first

# Fecha de hoy:
hoy = Date.today

# Para hacer pruebas podemos forzar la fecha de hoy:
#hoy = Date.new(2006,11,8)


# Comprobamos si es sábado o domingo:
# Sábado = 6
# Domingo = 0
if hoy.wday == 6 || hoy.wday == 0
agi.noop("Es fin de semana, colgamos")
# Reproducimos la grabación:
agi.stream_file("hoy-es-fin-de-semana")
agi.hangup()
exit
end


# Comprobamos los eventos del día de hoy:
cal.events.each do |event|
inicio = Date.new(event.dtstart.year, event.dtstart.month,
event.dtstart.day)
if event.dtend
fin = Date.new(event.dtend.year, event.dtend.month, event.dtend.day)
else
fin = inicio
end

# Comparamos con "hoy + 1" porque si un evento dura un día significa
que finaliza el día siguiente:
if inicio <= hoy && fin >= hoy + 1
event.categories.each do |categoria|
if categoria == categoria_festivo
agi.noop("Hoy es festivo, colgamos")
# Reproducimos la grabación:
agi.stream_file("hoy-es-festivo")
agi.hangup()
exit
end
end
end
end
================================================================================
I don't know what to do
no se que hacer..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top