Tropo help required

Getting started with the SIP Sorcery
Post Reply
gielchina
Posts: 7
Joined: Tue Aug 28, 2012 5:12 am

Tropo help required

Post by gielchina » Fri Dec 13, 2013 4:05 am

Dear Users/Admin,

I want to use Tropo as IVR for my call processing. I have gone trough sipsorcery help. I am not a very technical guy. Please suggest me script for tropo. I have already done with making a account there.

In the below script is about setting a pin for callback. Where I need no pin, just a greeting for callers, than if they press

1 - Office
2 - Sales
3 - accounts

And later according to there opting calls will go to associated sipsorcery sip accounts.

PLEASE GIVE ME THE SCRIPT WHAT I CAN USE IN TROPO. AND HOW CAN ASSOCIATE WITH SIPSORCERY.

require 'java'

username = "YOUR_SIPSORCERY_USERNAME"
pin = "1234"

answer()

# Restrict access by setting a PIN
pinask = { :choices => '[4 DIGITS]'}
pinResult = ask 'Please enter your pin', pinask
hangup() unless pinResult.value == pin

# Retrieve the callback number from the caller.
options = { :choices => '[1-20 DIGITS]', :terminator => '#', :mode => 'dtmf' }
callbackNum = ask 'Please enter your number then press pound', options
say "Thank you."

# Build the HTTP URL for the request to send back to SIPSorcery to initiate the transfer.
callID = $currentCall.getHeader("x-sbc-call-id")
svcURL = "http://www.sipsorcery.com/callmanager.s ... kNum.value}";
log "service URL=#{svcURL}"
url= java.net.URL.new svcURL

# Send the request to SIPSorcery.
conn = url.openConnection
log "javaURL created"
stm = conn.getInputStream
transferResult = org.apache.commons.io.IOUtils.toString(stm)
log "transfer result=#{transferResult}"
stm.close

# Play some music while the transfer is being processed.
say "http://202.6.74.107:8060/triplej.mp3"
hangup()

User avatar
Aaron
Site Admin
Posts: 4563
Joined: Thu Jul 12, 2007 12:13 am

Re: Tropo help required

Post by Aaron » Sun Dec 15, 2013 10:08 am

The scripts below should get you on the right track. Please note for the Tropo script you are better off asking on their support forums for help.

Tropo Script:

Code: Select all

require 'java'

username = "your_sipsorcery_username"

# Get option
optionAsk = { :choices => '[1 DIGITS]', :terminator => '#', :mode => 'dtmf'}
option = ask 'Please enter 1 for office, 2 for sales or 3 for support', optionAsk

if option.value == "1" then
  extension = "office"
elsif option.value == "2" then
  extension = "sales"
elsif option.value == "3" then
  extension = "support"
end

if extension != nil
  # Build the HTTP URL for the request to send back to SIPSorcery to initiate the transfer.
  callID = $currentCall.getHeader("x-sbc-call-id")
  svcURL = "http://www.sipsorcery.com/callmanager.svc/blindtransfer?user=#{username}&callid=#{callID}&destination=#{extension}";
  
  log "service URL=#{svcURL}"
  url= java.net.URL.new svcURL

  # Send the request to SIPSorcery.
  conn = url.openConnection
  log "javaURL created"
  stm = conn.getInputStream
  transferResult = org.apache.commons.io.IOUtils.toString(stm)
  log "transfer result=#{transferResult}"
  stm.close

  # Play some music while the transfer is being processed.
  say "http://202.6.74.107:8060/triplej.mp3"
else
  say "Sorry that option was not recognised, goodbye."
end

hangup()
On the sipsorcery end you will need a dialplan called "transfer" which is where you handle the call once it gets transferred back from Tropo.

Code: Select all

sys.Log("Blind transfer starting for #{req.URI.User} ...")
case req.URI.User
  when "office" then sys.Dial("your_office_extension@sipsorcery.com")
  when "sales" then sys.Dial("your_sales_extension@sipsorcery.com")
  when "support" then sys.Dial("your_support_extension@sipsorcery.com")
  else sys.Respond(404, nil)
end

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest