public Program()
        {
            Get["/hangup"] = x =>
            {
                Plivo.XML.Response resp = new Plivo.XML.Response();

                // Add Speak XML Tag
                resp.AddSpeak("This call will be hung up in 1 minute", new Dictionary<string, string>(){});

                // Add Hangup XML Tag
                resp.AddHangup(new Dictionary<string, string>() 
                {
                    {"reason","busy"}, // Specify the reason for hangup
                    {"schedule","60"} // Schedule the hangup
                });    

                Debug.WriteLine(resp.ToString());

                var output = resp.ToString();
                var res = (Nancy.Response)output;
                res.ContentType = "text/xml";
                return res;
            };

        }
Esempio n. 2
0
        public Program()
        {
            Get["/hangup"] = x =>
            {
                Plivo.XML.Response resp = new Plivo.XML.Response();

                // Add Speak XML Tag
                resp.AddSpeak("This call will be hung up in 1 minute", new Dictionary <string, string>()
                {
                });

                // Add Hangup XML Tag
                resp.AddHangup(new Dictionary <string, string>()
                {
                    { "reason", "busy" }, // Specify the reason for hangup
                    { "schedule", "60" } // Schedule the hangup
                });

                Debug.WriteLine(resp.ToString());

                var output = resp.ToString();
                var res    = (Nancy.Response)output;
                res.ContentType = "text/xml";
                return(res);
            };
        }
Esempio n. 3
0
        public Program()
        {
            Get["/reject_caller"] = x =>
            {
                string[] blacklist = { "1111111111", "2222222222" };

                String fromNumber = Request.Query["From"];

                Plivo.XML.Response resp = new Plivo.XML.Response();

                if (blacklist.Equals(fromNumber))
                {
                    resp.AddHangup(new Dictionary <string, string>()
                    {
                        { "reason", "rejected" }
                    });
                }
                else
                {
                    resp.AddSpeak("Hello, from Plivo!", new Dictionary <string, string>()
                    {
                    });
                }

                var output = resp.ToString();
                var res    = (Nancy.Response)output;
                res.ContentType = "text/xml";
                return(res);
            };
        }
        public Program()
        {
            Get["/reject_caller"] = x =>
            {
                string[] blacklist = {"1111111111","2222222222"};
 
                String fromNumber = Request.Query["From"];
 
                Plivo.XML.Response resp = new Plivo.XML.Response();
 
                if (blacklist.Equals(fromNumber))
                {
                    resp.AddHangup(new Dictionary<string, string>()
                {
                    {"reason", "rejected"}
                });
                }
                else
                {
                    resp.AddSpeak("Hello, from Plivo!", new Dictionary<string, string>() { });
                }
 
                var output = resp.ToString();
                var res = (Nancy.Response)output;
                res.ContentType = "text/xml";
                return res;
            };
        }