using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using TCX.Configuration;
using System.IO;

public partial class LoginVmail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        XmlDocument doc = new XmlDocument();

        PrepareStartPage(doc);

        Response.Expires = 0;
        Response.Cache.SetNoStore();
        Response.BufferOutput = true;
        Response.AddHeader("Connection", "close");

        doc.Save(Response.OutputStream);
    }

    private void PrepareStartPage(XmlDocument doc)
    {
        doc.Load(Request.PhysicalApplicationPath + "LoginVmail.vxml");
        XmlNode ext_grammar = doc.SelectSingleNode("/vxml/form/field[@name='ext_number_field']/grammar");
        if(ext_grammar!=null)
        {
            string dnLength = PhoneSystem.Root.GetParameterByName("ENL").Value;
            ext_grammar.InnerText = "#|[0-9|*]{"+dnLength+"}";
        }
    }
}
