Skip to content

Instantly share code, notes, and snippets.

ip-10-251-97-220 cron.daily # /etc/init.d/sysklogd restart
* Stopping Asterisk ... [ ok ]
* Shutting down atd ... [ ok ]
* sysklogd -> stop: klogd ... [ ok ]
* sysklogd -> stop: syslogd ... [ ok ]
* sysklogd -> start: syslogd ... [ ok ]
* sysklogd -> start: klogd ...
ip-10-251-97-220 etc # netstat -tn | grep 5038
tcp 0 0 127.0.0.1:57929 127.0.0.1:5038 ESTABLISHED
tcp 0 0 127.0.0.1:57928 127.0.0.1:5038 ESTABLISHED
tcp 0 0 127.0.0.1:5038 127.0.0.1:57929 ESTABLISHED
tcp 0 0 127.0.0.1:5038 127.0.0.1:57928 ESTABLISHED
ip-10-251-97-220 etc # cd cron.daily
ip-10-251-97-220 cron.daily # ls
logrotate.cron makewhatis syslog.cron
ip-10-251-97-220 cron.daily # nano -w syslog.cron
ip-10-251-97-220 cron.daily # ./syslog.cron
deploy@ip-10-251-97-220 /data/vipwithme/current $ netstat -tn | grep 5038
tcp 0 0 127.0.0.1:5038 127.0.0.1:52285 ESTABLISHED
tcp 0 0 127.0.0.1:5038 127.0.0.1:52284 ESTABLISHED
tcp 0 0 127.0.0.1:52285 127.0.0.1:5038 ESTABLISHED
tcp 0 0 127.0.0.1:52284 127.0.0.1:5038 ESTABLISHED
#methods that will be in scope for the events subsystem
methods_for :events do
def monitor_event(event)
case event.name.downcase
when 'hangup'
session = CallSession.find(:first, :conditions => { :client_channel => event.headers['Channel'] })
if session == nil
session = CallSession.find(:first, :conditions => { :vendor_channel => event.headers['Channel'] })
end
def verify_number_request(phonenumber_id)
phonenumber = PhoneNumber.find_by_id phonenumber_id
#Create a new hash with the guid as the key to track this call session
session = CallSession.new
session.session_type = 'verification'
session.phonenumber_id = phonenumber.id
session.client_id = phonenumber.user_id
session.client_channel = 'UNASSIGNED'
session.vendor_channel = 'UNASSIGNED'
methods_for :rpc do
# Simply create proxy methods for the high-level AMI methods
[:send_action, :introduce, :originate, :call_into_context, :call_and_exec].each do |method_name|
define_method(method_name) do |*args|
if VoIP::Asterisk.manager_interface
VoIP::Asterisk.manager_interface.send(method_name, *args)
else
ahn_log.ami_remote.error "AMI has not been enabled in startup.rb!"
deploy@ip-10-251-97-220 /data/vipwithme/current $ netstat -tn | grep 5038
tcp 0 0 127.0.0.1:59058 127.0.0.1:5038 CLOSE_WAIT
tcp 0 0 127.0.0.1:59057 127.0.0.1:5038 CLOSE_WAIT
def actions_connection_established
@actions_state = :connected
@actions_writer_thread = Thread.new(&method(:write_loop))
end
def actions_connection_disconnected
@actions_state = :disconnected
end
def events_connection_established
mysql> SHOW PROCESSLIST;
+-----+--------+--------------------------------------+----------------------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+--------+--------------------------------------+----------------------+---------+------+-------+------------------+
| 160 | deploy | ip-10-251-195-182.ec2.internal:47939 | vipwithme_production | Sleep | 2281 | | NULL |
| 159 | deploy | ip-10-251-195-182.ec2.internal:47938 | vipwithme_production | Sleep | 0 | | NULL |
| 165 | deploy | ip-10-251-195-182.ec2.internal:56432 | vipwithme_production | Sleep | 1 | | NULL |
| 164 | deploy | ip-10-251-195-182.ec2.internal:56431 | vipwithme_production | Sleep | 61 | | NULL |
| 163 | deploy | ip-10-251-195-182.ec2.internal:56430 | vipwithme_production | Sleep | 0 | | NULL |
| 162 | de
Working as intended:
-- Executing [s@click_to_call:1] AGI("SIP/callcentric-011fcd80", "agi://localhost") in new stack
-- AGI Script Executing Application: (playback) Options: (/var/lib/asterisk/sounds/vipwithme/tmp/nhO1hlN2-vkXK-RRKJ-mAHN- rnnqI84ClQEK)
-- <SIP/callcentric-011fcd80> Playing '/var/lib/asterisk/sounds/vipwithme/tmp/nhO1hlN2-vkXK-RRKJ-mAHN-rnnqI84ClQEK' (lang uage 'en')
-- Playing '/var/lib/asterisk/sounds/vipwithme/tmp/eEoWut6y-LujY-VWJj-90Zm-evT0gwdbPSMB' (escape_digits=1234567890*#) (sample_offset 0)
-- AGI Script Executing Application: (playback) Options: (/var/lib/asterisk/sounds/vipwithme/tmp/DvzMV84G-5hhx-fUXu-Srug-TFczbWF4pVVV)
-- <SIP/callcentric-011fcd80> Playing '/var/lib/asterisk/sounds/vipwithme/tmp/DvzMV84G-5hhx-fUXu-Srug-TFczbWF4pVVV' (language 'en')
-- AGI Script Executing Application: (conference) Options: (1/Sm)