Tropo is part of CiscoLearn More

The Conference Pop-In Timer

Posted on July 21, 2011 by Adam Kalsey

Have you ever wanted to set a timer on a conference call and pop-in at a certain time to either:

1) announce something, say, every 15 minutes;

2) let participants know that they have 2 minutes remaining; or

3) ask them a question or survey?

This is easy to do by connecting Tropo applications!  I created a quick demo using the Tropo Scripting API that allows people to call into a Tropo phone number, SIP address, or Skype address and after x seconds announce that they have two minutes remaining.  The demo code below is written in Ruby and it uses threading to start a timer and wait/sleep until x seconds has transpired.  Once the timer expires, it calls and conferences a second Tropo application via its SIP address and simply announces the warning message.  You could easily extend the second Tropo application to prompt the user to answer a single question or a take a poll/survey and report their answers back to the main application either via a database or via SIP headers on the transfer back to the application.

Here’s the Ruby source code on the main application:

#Method to create timeStamp as our conferenceID
def get_conference_id()
timeVar = Time.new
returnValue = timeVar.strftime("%Y%H%M%S")
return returnValue
end

conferenceOptions={
:mute=>false,
:playTones=>true,
:leaveprompt=>"beep"
}

begin

#Create conference ID
conferenceID = get_conference_id()

log "@"*5 + "User has answered"

#Create second thread for second for timer and announcements
Thread.new do
log "@"*5 + "Start second tread"

sleep 10

call 'sip:9996137086@sip.tropo.com', {
:onAnswer=>lambda{|event|
log "@"*5+"answered join conference"
newCall = event.value
newCall.conference(conferenceID,conferenceOptions)
}
}

end #thread

say 'You are now in conference.'
conference(conferenceID,conferenceOptions)

end

Here’s the Ruby source code of the announcement application:

say "you have two minutes remaining."

Note the SIP address used in the main application. It’s the SIP address assigned to your second announcement application by Tropo when it’s created. Every Tropo application automatically gets a SIP address, iNum address, Skype address, and Phono address assigned to it upon creation. You can transfer and conference calls app-to-app using SIP addresses and even pass data between them using SIP headers. How’s that for webscale?!

2 Responses

  1. Khalid Abuhakmeh says:

    Hello,

    I am trying to accomplish a pop in timer with the WebAPI but I’m lost as to how to do it, any change you could do a quick example of that?

    Thanks,

    Khalid

  2. The process is fairly similar using the WebAPI. The cron job calls your URL at a given time and then your app runs on your server and interacts with the Tropo WebAPI to place an outbound call. Here are examples from our quickstart menu on placing an outbound call using the WebAPI:

    https://www.tropo.com/docs/webapi/making_calls.htm.

    Hope this helps…

Leave a Reply