Programmable Voice

  1. Home
  2. Docs
  3. Programmable Voice
  4. Configuration
  5. Setting up your Voice Elements Application for Redundancy

Setting up your Voice Elements Application for Redundancy

You can set up your Voice Elements Application so that it automatically fails over when there is a network outage (or other issue).

The diagram below illustrates our redundant infrastructure architecture:

Redundancy Defense Lines

Redundancy Defense Lines


Setting up your Voice Elements Application for Redundancy

You will need to set up two instances of Voice Elements Server. One should be considered a primary, and the other should be considered a secondary or failover.

Set up Redundancy with Your SIP Carrier

Many SIP carriers will allow you to set up a primary server, and a failover server where they will send calls. This means that if your primary server does not respond to your SIP carrier, it will try to reach your failover server. Please note that you can generally assign a Primary and Failover server for each DID. This means that you can assign about half as the primary for one server, and the other half to have their primary on the second server. This way you are load balanced during normal operation (and the failover server doesn’t just sit idle).

Setting up Redundancy in Your Voice Elements Client Application

Lastly, you will need to configure your Voice Elements Client application to connect to both servers. Below is some example code that shows how to do this:

    System.Net.IPAddress[] ips1 = System.Net.Dns.GetHostAddresses("");
    if (ips1 == null || ips1.Length == 0) throw new Exception("Error: Could not resolve Telephony Server specified!");
    string sIpaddress1 = @"gtcp://" + ips1[0].ToString() + ":54331";
    //string sIpaddress1 = @"gtcp://" + ips[0].ToString() + ":54431";
    Log.Write("Connecting to: {0}", sIpaddress1);
    System.Net.IPAddress[] ips2 = System.Net.Dns.GetHostAddresses("");
    if (ips2 == null || ips2.Length == 0) throw new Exception("Error: Could not resolve Telephony Server specified!");
    string sIpaddress2 = @"gtcp://" + ips2[0].ToString() + ":54331";
    //string sIpaddress2 = @"gtcp://" + ips[0].ToString() + ":54431";
    Log.Write("or Connecting to: {0}", sIpaddress2);
    TelephonyServerLogin tsl1 = new TelephonyServerLogin();
    tsl1.Url = sIpaddress1;
    tsl1.Username = "";
    tsl1.Password = "test";
    TelephonyServerLogin tsl2 = new TelephonyServerLogin();
    tsl2.Url = sIpaddress2;
    tsl2.Username = "";
    tsl2.Password = "test";
    //###TelephonyServerLogin[] telephonyServerLogins = new TelephonyServerLogin[] { tsl1, tsl2 };
    TelephonyServerLogin[] telephonyServerLogins = new TelephonyServerLogin[] { tsl1 };
    s_TelephonyServer = new TelephonyServer(telephonyServerLogins);
    s_TelephonyServer.CacheMode = VoiceElements.Interface.CacheMode.ClientSession;
    //s_TelephonyServer.CacheMode = VoiceElements.Interface.CacheMode.Server;
    s_TelephonyServer.NewCall += new VoiceElements.Client.NewCall(s_TelephonyServer_NewCall);
    s_TelephonyServer.ConnectionLost += new ConnectionLost(s_TelephonyServer_ConnectionLost);
    s_TelephonyServer.ConnectionRestored += new ConnectionRestored(s_TelephonyServer_ConnectionRestored);
    veActive = true;
catch (Exception ex)
        if (s_TelephonyServer != null)
    catch (Exception) { } 
    Log.Write("IvrApplication::MainCode() Exception: " + ex.Message + "\r\n" + ex.StackTrace);
    throw ex;


Once you have done this, your application will be able to process calls from both Telephony Servers.

If there were a network outage at your primary server, your SIP carrier would then send your invites over to your secondary server. Your application that is setup to connect to both would then be able to automatically process the call sent in from the secondary server.

Was this article helpful to you? Yes 15 No