using System;
using System.Collections.Generic;
using System.Text;

public partial class PbxAPI : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        String func = Request.Params["func"];
        if (func == null)
        {
            func = "<null>";
        }

        Utils.Load3CXLicense();

        string result = null;
        switch (func)
        {
            case "make_call":
                result = Utils.MakeCall(Request.Params);
                break;
            case "upd_ext":
                result = Utils.UpdateExt(Request.Params);
                break;
            default:
                result = "Function " + func + " is not supported";
                break;
        }
        
        Response.Output.Write(result);
        Response.AddHeader("Content-Length", result.Length.ToString());
        Response.AddHeader("Connection", "close");
        Response.Flush();
    }
}
