Archive for the ‘SourceCode’ Category

How-To: Distinguish PSTN, Skype, iNum, and SIP in your Tropo applications

Tuesday, February 23rd, 2010

Here at the secret layers of Tropo Support we often see similar questions raised by our developer base. We pay attention to these trends, since they often indicate that something may be lacking in our documentation.   If we do find something is lacking we of course want to address by expanding on concepts or adding additional examples to help shore up our doc sets and help out our developers.

Recently I have started to notice a trend of developers asking how to determine the source of callers dialing into their applications (Skype, PSTN, SIP, or iNum).  We’ll since we are often asked this question I figured I would provide a nice example for the ‘class’ =), I do hope this help!

Regards,
John Dyer
Customer Engineer
Voxeo Support

# -----------
# route based on DNIS
# John Dyer
# Voxeo Support
# -----------
log "@"*10 + $currentCall.inspect   # List some headers
log "@"*10  + $currentCall.getHeader("x-voxeo-to")  # log to header

module SipRegex
  def evaluate_sip_header(header) 
    if header =~ /^<sip:990.*$/                   # SKYPE
      "SKYPE"
    elsif header =~ /^.*<sip:1999.*$/             # SIP
      "SIP"
    elsif header =~ /^<sip:883.*$/                # iNUM
      "INUM" 
    elsif header =~ /^.*<sip:|[1-9][0-9][0-9].*$/ # PSTN
      "PSTN"
    else
      "OTHER" 
    end
  end
end
include SipRegex

toHeader = evaluate_sip_header($currentCall.getHeader("x-voxeo-to"))

if toHeader == 'PSTN'
    answer
    log "@"*10 + toHeader
    hangup
  elsif toHeader == 'SKYPE'
    answer
    log "@"*10 + toHeader
    hangup
  elsif  toHeader == 'PSTN'
    answer
    log "@"*10 + toHeader
    hangup
  elsif  toHeader == 'INUM'
    answer
    log "@"*10 + toHeader
    hangup
  elsif toHeader == 'OTHER'
    answer
    log "@"*10 + toHeader
    hangup
  else
    log "@"*10 + "SOMETHING BAD HAPPENED" 
end

Tropo Adds Transcription for Recordings

Wednesday, August 26th, 2009

We have been busy adding additional features to Tropo with more to come. Today we are making available the ability to transcribe recorded audio and have the results posted to you via email or an HTTP POST. In addition to this, we have also created an option that allows you to send the recorded audio file out of the Tropo cloud directly to your servers via FTP or an HTTP POST. Now you may have easy access to recordings and what is being said!

To take advantage of this all you need to do is add a few extra options to your record method. Here is a Ruby example:

answer
say 'Welcome to ruby recording test'

event = record('Say something after the beep.',
{ :repeat              => 0,
:bargein             => true,
:beep                => true,
:silenceTimeout      => 2,
:maxTime             => 30,
:timeout             => 4.03456789,
:recordURI           => 'http://tropo.to-a-domain.com/post_audio?filename=file123456.wav',
:transcriptionOutURI => 'http://tropo.to-a-domain.com/receive_transcription',
:transcriptionID     => '123456' })

log 'Recorded file: ' + event.recordURI
say 'Thanks for your testing ruby on Tropo platform'
hangup

(Link)

Don’t forget that these new options are available in any of the languages supported by Tropo. So do not hesitate to add this to your Groovy, Javascript, PHP, Perl or Ruby scripts today!

We have more to come shortly, so stay tuned for additional features and helper apps to take advantage of these new features.

Opening the Tropo Cloud

Thursday, July 23rd, 2009

tropo.comlogo.jpgToday we announced the availability of the Tropo Servlet under an open-source license at OSCON. This is the next step in opening Tropo and building the developer community for open-source cloud telephony.

In the coming days we will be publishing additional details on the Tropo architecture and how the Tropo Servlet fits into SIP Servlet engines. In the meantime, everyone is welcome to have a look at the source code on Github: https://github.com/voxeo/tropo-servlet/.

Jason Goecke: Writing a Ruby app for Tropo

Friday, March 13th, 2009

Over on his blog, Jason Goecke recently published a great post: “Writing a Ruby app for Tropo” that provides an example of writing a Tropo app in Ruby. As Jason writes:

This example uses the Yahoo Query Language (YQL) to fetch the weather based on a US zip code you may either speak or touch tone in via your telephone key pad. The first step is to answer the phone and then welcome the user. The script then builds a Ruby hash, named ‘options’, that provides the instructions for building the menu and event handlers for Tropo.

Jason goes on in his post to provide source code and walk you through how to get the app set up on Tropo.com.

Thanks, Jason, for writing the post, and we look forward to seeing what other kind of apps people may write for Tropo.


If you found this post interesting or helpful, please consider either subscribing via RSS or following us on Twitter.


Technorati Tags: , , , ,

Over 140 sample Tropo applications and growing strong…

Tuesday, March 10th, 2009

Just over a week from the launch of Tropo.com and already our collection of sample applications has grown to over 140 across all five languages! (Groovy, JavaScript, PHP, python and Ruby)

As I mentioned previously (complete with more instructions), all of the sample applications are available for download from our Github account at:

http://github.com/voxeo/tropo-samples/tree/master

You can also view them on our docs.tropo.com site through either:

You are welcome to try out any of the sample apps in your own Tropo account. And please do keep checking back… we’ll be adding more sample apps in the weeks ahead.

P.S. Don’t forget… we’re paying $100 for each sample app we like! If you come up with some great sample apps, please do send them in.


If you found this post interesting or helpful, please consider either subscribing via RSS or following us on Twitter.


Technorati Tags: , , , , , , , , ,

Get the Tropo sample applications – via git and Github

Tuesday, March 3rd, 2009

githublogo-1.jpgWould you like to easily get your hands on the Tropo sample applications? I mean, you certainly can download them from the Tropo documentation website, but we’ve also made them very easy to download from our account on Github. All you need do to is go to:

http://github.com/voxeo/tropo-samples/tree/master

If you just want to download the sample application files, simply click the “download” button and you’ll have a choice of a ZIP or tar file:

github-download.jpg

Alternatively, if you have the git version control system installed on your computer, you can simply clone our Github repository:

git clone git://github.com/voxeo/tropo-samples.git

That will pull a copy onto your local system. We will be updating the repository quite frequently over the next while, so from time to time you will want to do:

git pull origin master

in your “tropo-samples” directory. That will pull down the changes from our Github repo. If you are already a Github user and want to suggest changes for us, feel free to fork our repo and then request a pull. (And if that last sentence made no sense to you, that’s okay.)

If you would like to learn more about Git, you can watch my Emerging Tech Talk podcasts #24, Learning Git, Part 1: Intro to Version Control Systems and #25, Learning Git, Part 2: Getting Started with Git.

We hope this makes the source code more accessible to you all – please let us know what you think about making code available this way.


If you found this post interesting or helpful, please consider either subscribing via RSS or following us on Twitter.


Technorati Tags: , , , , , ,