Guest User

Untitled

a guest
Jul 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. require 'rubygems'
  4. require 'fsr'
  5. require 'fsr/listener/outbound'
  6. require 'sequel'
  7.  
  8. DB = Sequel.connect('mysql://root@localhost/freeswitch')
  9.  
  10. module Prepaid
  11. def update_balance
  12. @timer = EM::PeriodicTimer.new(1) do
  13. # update the balance here.
  14. end
  15. end
  16. end
  17.  
  18. class Outbound < FSR::Listener::Outbound
  19. include Prepaid
  20.  
  21. def session_initiated
  22. answer do
  23. duration = 10
  24. update_balance
  25. sched_hangup(duration)
  26. end
  27. end
  28. end
  29.  
  30. FSR.start_oes! Core, :port => 8084, :host => "127.0.0.1"
Add Comment
Please, Sign In to add comment