Dial not working

IPCortex.PBX.device.dial(number, autohold, autoanswer, callback) API method for dial. When I try to call via this method I get error
" IPCortex.PBX.device.dial(room, true, true, null);
TypeError: Cannot read property ‘dial’ of undefined
at linesCB (…\server.js:56:36)
at initialCB [as _onTimeout] (…\node_modules\ipcortex-pabx/…/…/lib/api.js:1472:4)
at Timer.listOnTimeout (timers.js:110:15)"
because device is undefined too. How to fix this problem?

Hi Evgenly,

I think this is very similar to a question you asked a while ago in another thread. The device object isn’t a static object that you can reference as IPCortex.PBX.device, it is an instance of an actual device which you obtain, usually by hooking the lines callback when logged in as a user and getting a list of devices for that user then executing .dial on one of the returned device object.

If this is a simple “dial as the logged in user” then you should look at the SimpleCTI example API application which does exactly that.