newHelpline: +91-22-26201604 Ext.633/607.
Mobile Seva

How to write Dot Net (C#) Client for accessing IVRS Push Call API?

Note: IVRS Push Call API will be accessible with TLSv1.2 protocol. Kindly upgrade to latest .NET versions for TLSv1.2 support.

Kindly refer the below links for .NET TLS support and upgradation:-

Click to download the IVRS Push Call API C#.NET code file(Size:18KB)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Net;
using System.IO;
using System.Security;
using System.Security.Cryptography.X509Certificates;

namespace ConsoleApplication3

    class Program
        static void Main(string[] args)

            String username = ""
            String password = "";
            String MobileNumbers = "";
            String voiceCode = "";

            String postData = "username=" + username + "&password=" + password + "&MobileNo=" + MobileNumbers + "&CallID"+CallID +"&voiceCode=" + voiceCode;//data to post
            String url = "";//url 

            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.KeepAlive = false;
            request.ProtocolVersion = HttpVersion.Version10;
            request.Method = "POST";

            System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();

            byte[] array = Encoding.ASCII.GetBytes(postData);

            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = array.Length;
            Stream requestStream = request.GetRequestStream();

            requestStream.Write(array, 0, array.Length);

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Console.WriteLine(new StreamReader(response.GetResponseStream()).ReadLine());

        class MyPolicy : ICertificatePolicy
            public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem)
                return true;

What's New