Sie sind auf Seite 1von 5

Here is some sample code..Try this... I am using this type of Procedure : DateOptions.

<?xml version="1.0"?> <vxml version="2.0" xmlns=""> <%@ Page Language="C#" CodeFile="DateOptions.aspx.cs" Inherits="_DateOptions" %> <%Response.Cache.SetCacheability(HttpCacheability.NoCache);%> <var name="Button" expr="''" /> <form> <nomatch> I Can't understand your input. <reprompt/> </nomatch> <noinput> you have entered nothing. <reprompt/> </noinput> <field name="DateOptions"> <prompt> For checking today's date and Month press 1,for time press 2, for day press 3, otherwise simply hangup. </prompt> <grammar xml:lang="en-US" mode="dtmf" version="1.0" xmlns="" tag-format="swi-semantics/1.0" root="Digits">

<rule id="Digits" scope="public"> <one-of> <item>1</item> <item>2</item> <item>3</item> </one-of> </rule> </grammar> <filled> <if cond="DateOptions=='1'"> <assign name="Button" expr="'1'" /> <submit next="<%=Response.ApplyAppPathModifier("Dayprompt.aspx") %>" namelist="Button"/> <elseif cond="DateOptions=='2'"/> <assign name="Button" expr="'2'" /> <submit next="<%=Response.ApplyAppPathModifier("Dayprompt.aspx") %>" namelist="Button"/> <elseif cond="DateOptions=='3'"/> <assign name="Button" expr="'3'" /> <submit next="<%=Response.ApplyAppPathModifier("Dayprompt.aspx") %>" namelist="Button"/> <else /> <clear namelist="DateOptions"/> <throw event="nomatch" /> </if> </filled> </field>

</form> </vxml>

Nothing in .cs file...leave it blank.

2nd page Dayprompt.aspx

<?xml version="1.0"?> <vxml version="2.0" xmlns=""> <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Dayprompt.aspx.cs" Inherits="_Dayprompt" %> <%Response.Cache.SetCacheability(HttpCacheability.NoCache);%> <% string Button = HttpContext.Current.Request.QueryString.Get("Button"); string prompt = ""; string date = ""; int n=myVxmlCode(ref prompt, ref date,Button); %> <form> <%if (n==1) { %> <block> <prompt> <%=prompt%><break strength="small"/> <say-as interpret-as="date" format="md"><%=date %></say-as>. </prompt> </block> <% } else if (n ==2) { %> <block> <prompt> <%=prompt%><break strength="small"/> <say-as interpret-as="duration" format="hms"><%=date %></say-as>. </prompt> </block>

<% } else { %> <block> <prompt> <%=prompt%><break strength="small"/><%=date %>. </prompt> </block> <% } %> <block > <prompt>Thankyou for Calling GoodBye !</prompt> <disconnect/> </block> </form> </vxml>


using System; using System.Data; public partial class _Dayprompt : System.Web.UI.Page { public int myVxmlCode(ref string prompt, ref string date,string Button) { DateTime dt = DateTime.Now; if (Button == "1") { date = DateTime.Now.ToString("MMMM dd"); prompt = "Hello sir! today's date is"; return 1; } else if(Button=="2") { date = DateTime.Now.ToString("T"); prompt = "Hello sir! Current time is"; return 2; } else { date = DateTime.Now.ToString("dddd"); prompt = "Hello sir! Current day is"; return 3; } } }

Test it..