This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Migration | |
create_table :business_time_members do |t| | |
t.string :name, :limit => 100 | |
t.integer :business_time_id | |
t.time :time_from, :default => '2000-01-01 00:00:00' | |
t.time :time_to, :default => '2000-01-01 23:59:59' | |
t.integer :weekday # 0 - sunday, 1 - monday, 2 -tuesday, ... | |
t.integer :day_of_month # 1-31 | |
t.integer :month # 1-12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# NOTE - Following code was tested with AsteriskRuby gem and Adhearsion v. 1.2.3 | |
require 'rubygems' | |
require 'pp' | |
require 'monitor' | |
require 'timeout' | |
require 'time' | |
require 'AGIServer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'monitor' | |
require 'pp' | |
require 'timeout' | |
require 'time' | |
require 'pp' | |
require 'rubygems' | |
require 'AGIServer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Loads initial data (use once after migration)" | |
task "db:initialize" do | |
require './lib/initialize' | |
require 'fileutils' | |
# Print out DB log | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Base.logger.level = Logger::DEBUG | |
YAML::load_file("#{APP_ROOT}/config/pbxes.yml").each_pair do |name,params| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find next number to send call | |
def next_number | |
# first parse CDRs | |
Cdr.parse | |
# find number | |
sql_request = %{campaign_id = ? and | |
call_state = ? and | |
number_of_retries < ? and | |
(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(updated_at)) <= ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: ahn | |
# Required-Start: ahn daemon | |
# Required-Stop: ahn daemon | |
# chkconfig: 2345 91 60 | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Adhearsion daemon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. | |
require 'rubygems' | |
require 'rails/commands/server' | |
require 'rack' | |
require 'webrick' | |
require 'webrick/https' | |
module Rails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mongodb_keys(from,to,data) | |
if data.kind_of? Hash | |
result = {} | |
data.each_pair do |k,v| | |
result[k.to_s.gsub(from, to)] = mongodb_keys(from, to, v) | |
end | |
return result | |
elsif data.kind_of? Array | |
result = [] | |
data.each do |v| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://npmjs.org/install.sh | sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
amportal stop | |
# install epel repo | |
yum instll iksemel-devel srtp-devel libsrtp-devel spandsp-devel | |
yum -y update | |
yum -y groupinstall core && yum install -y tmux patch screen gcc gcc-c++ lynx bison mysql-devel sqlite-devel sqlite libsqlite3x-devel php php-mysql php-pear php-mbstring tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git subversion kernel-devel php-process crontabs cronie cronie-anacron wget odbc-devel unixODBC unixODBC-devel mysql-connector-odbc libtool libtool-ltdl libtool-ltdl-devel libcurl-devel libogg-devel libvorbis-devel speex-devel freetds-devel net-snmp-devel corosynclib-devel popt-devel lua-devel portaudio-devel libresample-devel neon-devel libical-devel openldap-devel gmime22-devel sqlite2-devel libedit-devel libuuid-devel openssl-devel doxygen kernel-headers-`uname -r` kernel-devel-`uname -r` glibc-headers | |
cp -R /etc/asterisk /etc/asterisk-backu |