Tropo - IVR from Voxeo using Ruby

Share your views, news, tips and articles about VoIP
Post Reply
User avatar
rmclaren
Posts: 68
Joined: Sun Feb 17, 2008 10:28 pm
Location: Connecticut

Tropo - IVR from Voxeo using Ruby

Post by rmclaren » Sun Mar 22, 2009 8:33 pm

Last year I brought up the subject of Voxeo for offloading IVR to the cloud:

http://www.mysipswitch.com/forum/viewtopic.php?t=542

I experimented a bit, but did not get too far. Voxeo has now expanded its offering by introducing Tropo. (http://www.tropo.com)

While there are similarities, and the underlying IVR engine is the same, you can now program the IVR in a language of your choice, including Ruby, which fits in well with MSS. There are several examples in the various languages. You can be up-and-running with an account and your own versions of the examples in a few minutes. Ultimately, there will charges of a few cents (US$0.03 or US$0.04 per minute) for access. In the meantime, you can use a developer account with a nominal balance of around US$100.

You can access the IVR by SIP, Skype, iNum, and a US DID. So for example, you can move to and from MSS <-> IVR using SIP, but you can also use Skype to access MSS with code as simple as:

Code: Select all

answer
wait 2000
say 'Please wait while I connect your call'
transfer "sip:<MSS USER NAME@sip.mysipswitch.com"
The "wait 2000" puts in a 2 second delay, so that the voice prompt is not missed - a quirk that Tropo will soon fix. Of course, if this is all you do with your developer account, you will be cut off. However, once Tropo goes commercial, maybe a few cents per minute for Skype interconnectivity would be quite reasonable. In any case, this is just an example of the simplicity of the system. It will soon intrerface with Adhearsion for much more complex uses.

To test the system, I re-wrote my own version of the Ruby script that reads out Yahoo's weather forecast when you punch in the ZIP code. It is fascinating how powerful a few lines of Ruby code are.

My aim is to filter calls coming into MSS by Caller ID and time, and transfer to Tropo for processing where interaction is required. The pay-as-you-go model would be worthwhile in this case.

jvwelzen
Posts: 716
Joined: Thu Sep 11, 2008 1:56 pm

Post by jvwelzen » Tue Mar 31, 2009 3:48 pm

I am really having fun with this

On hold function

Code: Select all



#Ruby
answer
wait 2000

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/1aa1.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/1aa2.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/1aa3.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/1aa4.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/1aa5.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/1aa6.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/1aa7.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/1aa8.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/ss1.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/ss2.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/ss3.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/ss4.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/ss5.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/ss6.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"


say 'http://www.huizenwireless.nl/new/no_answer.wav'

hangup


vad987
Posts: 26
Joined: Tue Jan 22, 2008 7:45 am

Post by vad987 » Tue Mar 31, 2009 5:33 pm

jvwelzen wrote:I am really having fun with this

On hold function

Code: Select all



#Ruby
answer
wait 2000

say 'http://www.huizenwireless.nl/new/please_hold.wav'
say 'http://www.huizenwireless.nl/new/1aa1.wav'
say 'http://www.huizenwireless.nl/new/please_hold.wav'
transfer "8829900773513@huizenwireless.nl"

[/quote]
in more detail perhaps? 
I use voxeo Evolution Designer, call mss - login@sip.voxeo.net -ivr -transfer than your version differs very much

jvwelzen
Posts: 716
Joined: Thu Sep 11, 2008 1:56 pm

Post by jvwelzen » Wed Apr 01, 2009 5:52 pm

It's not really a hold function it is more like a hunting function

First It plays the first 30 seconds from a song

then try's to dial the uri for 12 seconds if not picked up

It again plays the next 30 seconds from the same song

and try's it again an so on for max time of 10 ninutes

afther 10 minuts it says no answer

jvwelzen
Posts: 716
Joined: Thu Sep 11, 2008 1:56 pm

Post by jvwelzen » Wed Apr 01, 2009 5:59 pm

I was thinking to write a sort of call queue

is there someone with some experience in writing ruby

The idea was to when a user calls in it's user 1

then when a seconde users call in it's user 2

then when i pick up the phone it connects to user 1

then when i am finished it connects to user 2 and so on

and when a user calls in he will hear it's position from time to time with some background music of course

Does someone have an idea where to start...

Thanks in advance

jvwelzen
Posts: 716
Joined: Thu Sep 11, 2008 1:56 pm

Post by jvwelzen » Sat Apr 04, 2009 6:20 pm

I have made my first tropo date and time reader script

here is the script :

Code: Select all


<?php
//
//  The application generates dutch date and time


$t = time() + (2 * 60 * 60);

$time1 = (date("H",$t));
$time2 = (date("i",$t));
$date1 = (date("l",$t));
$date2 = (date("F",$t));
$date3 = (date("j",$t));
$jaar = (date("Y",$t));

answer();
$s_begin_say = "Today";
$s_final_say = "Goodbye!";
$s_log_prefix = "Log: ";
$s_xml_speak_start ="<?xml version='1.0'?><speak>";
$s_say_as_speak_end = "</say-as></speak>";
wait(1000);
//Welcome:;
prompt($s_begin_say);
Wait(300);
//Date:;
$s_date_say_as = "<say-as interpret-as='vxml:date'>";
$s_date_value = "$date1";
$s_prompt = $s_xml_speak_start . $s_date_say_as . $s_date_value . $s_say_as_speak_end;
_log($s_log_prefix . $s_prompt);
prompt($s_prompt);
wait(500);
//Date:;
$s_date_say_as = "<say-as interpret-as='vxml:date'>";
$s_date_value = "$date2";
$s_prompt = $s_xml_speak_start . $s_date_say_as . $s_date_value . $s_say_as_speak_end;
_log($s_log_prefix . $s_prompt);
prompt($s_prompt);
wait(500);
//Date:;
$s_date_say_as = "<say-as interpret-as='vxml:date'>";
$s_date_value = "$date3";
$s_prompt = $s_xml_speak_start . $s_date_say_as . $s_date_value . $s_say_as_speak_end;
_log($s_log_prefix . $s_prompt);
prompt($s_prompt);
wait(500);
//Date:;
$s_date_say_as = "<say-as interpret-as='vxml:date'>";
$s_date_value = "$jaar";
$s_prompt = $s_xml_speak_start . $s_date_say_as . $s_date_value . $s_say_as_speak_end;
_log($s_log_prefix . $s_prompt);
prompt($s_prompt);

Wait(700);

//time:;
$s_time_say_as = "<say-as interpret-as='vxml:time'>";
$s_time_value = "$time1";
$s_prompt = $s_xml_speak_start . $s_time_say_as . $s_time_value . $s_say_as_speak_end;
_log($s_log_prefix . $s_prompt);
prompt($s_prompt);
wait(300);
//time:;
$s_time_say_as = "<say-as interpret-as='vxml:time'>";
$s_time_value = "$time2";
$s_prompt = $s_xml_speak_start . $s_time_say_as . $s_time_value . $s_say_as_speak_end;
_log($s_log_prefix . $s_prompt);
prompt($s_prompt);

wait(2000);
prompt($s_final_say);
wait(1000);
hangup();
//
//
?>
if you want to make a test call, call to :

sip:9991428711@sip.tropo.com

Post Reply