Show / Hide Table of Contents

    Custom IVR Template: CE Endpoint Available

    Checks CE endpoint availability using SIP Options requests

    Template Data Sheet

    Name Minimum Engine version Minimum Designer version
    CEEndpointAvailable 2.1 7.5.0

    Parameters

    Name Description
    m_domain Input: Name of the domain where campaign is registered
    m_sipuri Input: SipURI of the CE campaign, in format: sip:...@...
    m_compsrv Input: Component server URL: eg. http://127.0.0.1/CompSrv/ceoh.comp

    Exit Points

    Name Description
    available Endpoint with sip uri is available (responded to OPTIONS request)
    notavailable Endpoint with sip uri is not available (not responded to OPTIONS of nonexisting campaign sipuri)
    error Unable to verify endpoint state ( compsrv not available etc)

    JSON

    {
      "name": "CEEndpointAvailable",
      "type": "template",
      "description": "<b>CEEndpointAvailable</b> template:<br/> Checking CE using SIP options",
      "attributes": [
        {
          "name": "id",
          "type": "integer",
          "defaultvalue": "6500"
        }
      ],
      "parameters": [
        {
          "name": "m_domain"
        },
        {
          "name": "m_sipuri"
        },
        {
          "name": "m_compsrv"
        }
      ],
      "connections": [
        {
          "name": "available"
        },
        {
          "name": "notavailable"
        },
        {
          "name": "error"
        }
      ]
    }
    

    XML

    <template name="CEEndpointAvailable" id="#ID#" version="1.0">
      <parameters>
        <parameter id="m_domain"><![CDATA[#M_DOMAIN#]]></parameter>
        <parameter id="m_sipuri"><![CDATA[#M_SIPURI#]]></parameter>
        <parameter id="m_compsrv"><![CDATA[#M_COMPSRV#]]></parameter>
      </parameters>
      <connections namedoutputs="true">
        <connection name="available" destination="#AVAILABLE#" />
        <connection name="notavailable" destination="#NOTAVAILABLE#" />
        <connection name="error" destination="#ERROR#" />
      </connections>
      <flow>
        <nodes>
          <script id="1">
            <parameters>
              <parameter id="m_domain" type="Variable" datatype="String" direction="Input">?</parameter>
              <parameter id="m_sipuri" type="Variable" datatype="String" direction="Input">?</parameter>
              <parameter id="m_compsrv" type="Variable" datatype="String" direction="Input">?</parameter>
            </parameters>
            <connections namedoutputs="true">
              <connection exitpoint="available" name="AVAILABLE" destination="?" />
              <connection exitpoint="notavailable" name="NOTAVAILABLE" destination="?" />
              <connection exitpoint="error" name="ERROR" destination="?" />
            </connections>
            <data><![CDATA[
    
    $$nextConnection$$ = 'ERROR';
    var domain = '' + LOCALS['m_domain'];
    var url = '' + LOCALS['m_compsrv'];
    var sipuri = '' + LOCALS['m_sipuri'];
    var timeout = 10000;
    var mimetype = 'application/jsonrequest';
    
    try {
    
      var js = toolkit.getJSonRetriever();
      var req = {};
      req["action"] = 'EndpointAvailable';
      req["domain"] = domain;
      req["sipuri"] = sipuri;
    
      var sresp = js.postData(url,timeout,JSON.stringify(req),mimetype);
    
      if (sresp == null) {
    
          $$nextConnection$$ = 'ERROR';
      } else {
    
          log.debug('EndpointAvailable received:' + sresp);
    
          var resp = JSON.parse(sresp);
    
          if (resp["result"] == "ERROR") {
    
              $$nextConnection$$ = 'ERROR';
          } else if (resp["result"] == "TRUE") {
    
              $$nextConnection$$ = 'AVAILABLE';
          } else if (resp["result"] == "FALSE") {
    
              $$nextConnection$$ = 'NOTAVAILABLE';
          }
      }
    } catch(err) {
    
      log.error('Failed to check endpoint availability:' + 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