Interface Mirror

Proper Solutions to Software Development Problems

  Home  |   Contact  |   Syndication    |   Login
  18 Posts | 8 Stories | 16 Comments | 1 Trackbacks

News



Article Categories

Archives

Post Categories

Link

This simple program demonstrates getting input from AGI and replying it back.

using System;
using AGI;

namespace AsteriskGeeks
{
      public class Program
      {
         static void Main ( string [ ] args )
         {
             MonoTone mono = new MonoTone ();
             Keypad key = new Keypad ();
             //
             // GetData method is used to play a sound file Also wait M Mili seconds till timeout
             // for N number of expected numbers (M second for every 1 digit).
             // Following line of code will play Please Enter One Number (I have created one folder
             // named Samples in sounds directory and my gsm file named PleaseEnterYourNumber in it)
             // and in wait for 10 seconds for user to input 1 digit.
             //
                
              String
input = mono . GetData ( "Samples/PleaseEnterYourFirstNumber" , 10000 , 1 );
              //
              // If you don't input any digit for 10 seconds, timeout will be reached and
              // input of "" will be received.
              //
              if ( !( input . Equals ( "" ) && input . Equals ( "*" ) && input . Equals ( "#" ) ) )
              {
                    //I have placed YouHaveEntered.gsm in sounds/Samples 
                    mono . StreamFile ( "Samples/YouHaveEntered" , "" , out key );
                    //Digits are kept in sounds/digits
                    mono . StreamFile ( "digits/"+input , "" , out key );
              }
              mono . HangUp ();
         }
      }
}

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Tuesday, March 06, 2007 6:36 PM