Guest User

Untitled

a guest
May 25th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #controller app
  2. numbers_to_call.each{|phone|
  3. AHN = Drb...
  4. AHN.async_originate_call(num, sip_peer)
  5. }
  6.  
  7.  
  8.  
  9. # Adhearsion events.rb
  10. events.asterisk.manager_interface.each do |event|
  11. if event.name == 'OriginateResponse'
  12. # Grab the mdr_id if this originate response matches the unique ID (action id ) of one we have previously stored
  13. ahn_log event.headers['ActionID']
  14. ahn_log OriginateResponses[event.headers['ActionID']]
  15. ahn_log event.pretty_inspect
  16.  
  17. mdr_id = OriginateResponses[event.headers['ActionID']]
  18. update_call_status(mdr_id)
  19. end
  20. end
  21.  
  22.  
  23. # dialplan
  24.  
  25. context {
  26. mdr_id = variable("mdr_id")
  27. amdstatus = variable("AMDSTATUS")
  28.  
  29. ahn_log "going to deliver message based on mdr #{mdr_id} with an AMD status of #{amdstatus}"
  30.  
  31. mdr = MessageDeliveryResult.find_by_id(mdr_id)
  32. do adhearsion call stuff
  33. mdr.attr = somthing
  34. mdr.save
  35. }
Add Comment
Please, Sign In to add comment