Skip to content

Instantly share code, notes, and snippets.

@libryder
Created January 12, 2012 17:14
Show Gist options
  • Save libryder/1601807 to your computer and use it in GitHub Desktop.
Save libryder/1601807 to your computer and use it in GitHub Desktop.
Outbound dialer example in Adhearsion
# Check pin number against user's attempt, wait for a number to dial, connect caller to callee and play disclaimer to callee
# The method of setting these variables has been simplified for clarity
pin = '1234'
caller_id = '1112223333'
play_prompt = true
tts = '...'
if play_prompt
tts = format_ssml("Please enter your pin number.")
end
pin_entry = input 4, :speak => { :text => tts }
if pin_entry.to_s == pin.to_s
did = input 10, :play => "dialtone", :interruptible => true
else
hangup
end
# http://www.voip-info.org/wiki/view/Asterisk+cmd+Dial#Options
options = "A(lmc/monitored-and-recorded)"
dial_string = "SIP/#{trunk}/#{@id}"
dial(dial_string, :caller_id => caller_id, :options => options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment