Skip to content

Instantly share code, notes, and snippets.

@sprite2005
Created May 20, 2010 18:40
Show Gist options
  • Select an option

  • Save sprite2005/407912 to your computer and use it in GitHub Desktop.

Select an option

Save sprite2005/407912 to your computer and use it in GitHub Desktop.
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'
session.save
response = originate({ :channel => format_number(phonenumber.number, phonenumber.phone_type.phonetype),
:context => 'verify_number',
:exten => 's',
:priority => '1',
:variable => "session_id=#{session.id}",
:timeout => ::APP_CONFIG['adhearsion']["time_to_answer_timeout"]*1000,
:async => 'true' })
session.actionid = response.headers["ActionID"]
session.save
return session.id
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment