API Version: Development

Loading the API

Loading

To load the API into your application page, choose one of the following.

Loading the API and dependencies

For basic chat, call control and contact status you only need to load api.js.
<script src="http://pabx.hostname/api/api.js" />
To add chat audio/video support additionally load adapter.js, load order is important.
<script src="http://pabx.hostname/cinclude/adapter.js"></script>
<script src="http://pabx.hostname/api/api.js"></script>
To enable all features of the API (keevio phone, chat AV) also load jssip.js in the order shown.
<script src="http://pabx.hostname/cinclude/adapter.js"></script>
<script src="http://pabx.hostname/api/jssip/jssip.js"></script>
<script src="http://pabx.hostname/api/api.js"></script>

Loading using helpers

There are also some helper/wrapper scripts which load a set of files and carry out a basic initialisation for you. These mechanism expect you to provide a global function called onAPILoadReady() which will be called when the API is loaded. Choose one of:
<script src="http://pabx.hostname/api/wrapper.whtm"></script>
<script src="http://pabx.hostname/api/wrapper_av.whtm"></script>
<script src="http://pabx.hostname/api/wrapper_kphone.whtm"></script>
<script src="http://pabx.hostname/api/wrapper_lite.whtm"></script>
Each of the above requires onAPILoadReady as per the following example:
<script>
    function onAPILoadReady() {
        console.log('API ready to proceed');
        /* Your code here */
    }
</script>

Using the API from node.js

npm install --save ipcortex/node-api
var IPCortex = require('ipcortex-pabx');
See here for more information.