Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'rubygems'
- require 'fsr'
- require 'fsr/listener/outbound'
- require 'sequel'
- DB = Sequel.connect('mysql://root@localhost/freeswitch')
- module Prepaid
- def update_balance
- @timer = EM::PeriodicTimer.new(1) do
- # update the balance here.
- end
- end
- end
- class Outbound < FSR::Listener::Outbound
- include Prepaid
- def session_initiated
- answer do
- duration = 10
- update_balance
- sched_hangup(duration)
- end
- end
- end
- FSR.start_oes! Core, :port => 8084, :host => "127.0.0.1"
Add Comment
Please, Sign In to add comment