Built motion from commit (unavailable).|2.3.95
[motion2.git] / server / services / agi / server.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xbe5e=['E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections'];(function(_0x432813,_0xab9e9a){var _0x353280=function(_0x51a3f3){while(--_0x51a3f3){_0x432813['push'](_0x432813['shift']());}};_0x353280(++_0xab9e9a);}(_0xbe5e,0x81));var _0xebe5=function(_0x48a010,_0x526602){_0x48a010=_0x48a010-0x0;var _0x423b5b=_0xbe5e[_0x48a010];return _0x423b5b;};'use strict';var util=require(_0xebe5('0x0'));var net=require(_0xebe5('0x1'));var EventEmitter=require('events')[_0xebe5('0x2')];var AGIError=require(_0xebe5('0x3'));var AGIChannel=require(_0xebe5('0x4'));var AGIServer=function(_0x2a1302,_0x4389c3,_0x43d7f7){var _0x1e3335=this,_0x2a1302=_0x2a1302||0x11dd,_0x4389c3=_0x4389c3||_0xebe5('0x5'),_0x5aa5e5=null,_0x35cf69=0x0;EventEmitter[_0xebe5('0x6')](_0x1e3335);function _0x73d4df(){if(!_0x2a1302){_0x1e3335[_0xebe5('0x7')](_0xebe5('0x8'),new AGIError(_0xebe5('0x9')));return![];}_0x5aa5e5=net[_0xebe5('0xa')]();_0x5aa5e5[_0xebe5('0xb')](_0x2a1302,_0x4389c3);_0x5aa5e5['on']('listening',function(){_0x1e3335['emit'](_0xebe5('0xc'));});_0x5aa5e5['on'](_0xebe5('0xd'),function(_0x5882ff){_0x5aa5e5[_0xebe5('0xe')](function(_0x1e8eec,_0x5d8bde){if(_0x1e8eec){_0x1e3335[_0xebe5('0x7')](_0xebe5('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x1e8eec));}else if(_0x43d7f7&&_0x43d7f7<0x0){_0x1e3335['emit']('error',new AGIError(_0xebe5('0xf')));_0x5882ff[_0xebe5('0x10')]();}else if(_0x43d7f7&&_0x43d7f7>0x0&&_0x43d7f7<_0x5d8bde){_0x35cf69+=0x1;_0x1e3335['emit'](_0xebe5('0x8'),new AGIError(_0xebe5('0x11'),_0x35cf69));_0x5882ff[_0xebe5('0x10')]();}else{var _0x493670=new AGIChannel(_0x5882ff);_0x493670['on'](_0xebe5('0x12'),function(){_0x1e3335[_0xebe5('0x7')](_0xebe5('0xd'),_0x493670);});}});});_0x5aa5e5['on']('error',function(_0x505224){_0x1e3335['emit'](_0xebe5('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x505224['code']));});_0x5aa5e5['on'](_0xebe5('0x13'),function(){_0x1e3335[_0xebe5('0x7')](_0xebe5('0x13'),new AGIError(_0xebe5('0x14')));});}process[_0xebe5('0x15')](function(){_0x73d4df();});};util[_0xebe5('0x16')](AGIServer,EventEmitter);module[_0xebe5('0x17')]=function(_0x521ac8,_0x3be153,_0x5eae64){return new AGIServer(_0x521ac8,_0x3be153,_0x5eae64);};