Show / Hide Table of Contents

    Custom IVR Template: CE Failing Over

    Check whether CE is in the middle of a failover transition at the moment. Useful before a transfer or any CE related query.

    Template Data Sheet

    Name Minimum Engine version Minimum Designer version
    CEFailingOver 2.0.8 7.5.0

    Parameters

    Name Description
    m_domain Input: Name of the domain where campaign is registered
    m_compsrv Input: Component server URL: eg. http://127.0.0.1/CompSrv/ceoh.comp

    Exit Points

    Name Description
    error Failed to check CE failover transition state.
    ok No CE failover transition is in progress at the moment.
    transition CE observes a failover transition right now.

    JSON

    {
      "name": "CEFailingOver",
      "type": "template",
      "description": "<b>CEFailingOver</b> template:<br/> Detect CE Failover transition",
      "attributes": [
        {
          "name": "id",
          "type": "integer",
          "defaultvalue": "7500"
        }
      ],
      "parameters": [
        {
          "name": "m_compsrv"
        },
        {
          "name": "m_domain"
        }
      ],
      "connections": [
        {
          "name": "error"
        },
        {
          "name": "transition"
        },
        {
          "name": "ok"
        }
      ]
    }
    

    XML

    <template name="CEFailingOver" id="#ID#" version="1.0">
      <constraints>
        <errors AllAttributesRequired="true" />
        <warnings MinIncomingConnections="1" AllConnectionsRequired="true" />
      </constraints>
      <parameters>
        <parameter id="m_compsrv"><![CDATA[#M_COMPSRV#]]></parameter>
        <parameter id="m_domain"><![CDATA[#M_DOMAIN#]]></parameter>
      </parameters>
      <connections namedoutputs="true">
        <connection name="error" destination="#ERROR#" />
        <connection name="transition" destination="#TRANSITION#" />
        <connection name="ok" destination="#OK#" />
      </connections>
      <flow>
        <nodes>
          <script id="30">
            <parameters>
              <parameter id="m_compsrv" type="variable" datatype="string" direction="input">?</parameter>
              <parameter id="m_domain" type="Variable" datatype="String" direction="input"><![CDATA[?]]></parameter>
            </parameters>
            <connections namedoutputs="true">
              <connection name="ERROR" exitpoint="error" destination="?" />
              <connection name="TRANSITION" exitpoint="transition" destination="?" />
              <connection name="OK" exitpoint="ok" destination="?" />
            </connections>
            <data><![CDATA[
    
    $$nextConnection$$ = 'ERROR';
    var domain = '' + LOCALS['m_domain'];
    var url = '' + LOCALS['m_compsrv'];
    var tenantid = flowvars['TENANT_ID'];
    
    if (tenantid === null) {
    
      log.error("Tenant id not specified");
      $$nextConnection$$ = 'ERROR';
    } 
    else {
    
      var timeout = 10000;
      var mimetype = 'application/jsonrequest';
    
      try {
    
          var js = toolkit.getJSonRetriever();
          var req = {};
          req["action"] = 'FailingOver';
          req["domain"] = domain;
          req["tenant"] = parseInt(tenantid);
    
          var sresp = js.postData(url,timeout,JSON.stringify(req),mimetype);
    
          if (sresp == null) {
    
              $$nextConnection$$ = 'ERROR';
          } 
          else {
    
              log.debug('FailingOver received:' + sresp);
    
              var resp = JSON.parse(sresp);
    
              if (resp["result"] == "ERROR") {
    
                  $$nextConnection$$ = 'ERROR';
              } 
              else if (resp["result"] == "TRUE") {
    
                  $$nextConnection$$ = 'TRANSITION';
              } 
              else {
    
                  $$nextConnection$$ = 'OK';
              }
          }
      } catch(err) {
      
          log.error('Failed to perform ce failover transition check:' + err);
      }
    }
    
    log.debug('Script Done: nextConnection=' + $$nextConnection$$);
    ]]>        </data>
          </script>
        </nodes>
      </flow>
    </template>
    
    Sorry, your browser does not support inline SVG. article updatedarticle updated2/21/2024 3:19:17 PM (UTC)2/21/2024 3:19:17 PM (UTC)
    Feedback     Back to top Copyright © Geomant