Built motion from commit (unavailable).|2.4.8
[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 _0x1f38=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error'];(function(_0x5c3e0d,_0x2223fc){var _0x577c11=function(_0x2a160a){while(--_0x2a160a){_0x5c3e0d['push'](_0x5c3e0d['shift']());}};_0x577c11(++_0x2223fc);}(_0x1f38,0xd7));var _0x81f3=function(_0x50667a,_0x86eb28){_0x50667a=_0x50667a-0x0;var _0x4987e5=_0x1f38[_0x50667a];return _0x4987e5;};'use strict';var util=require(_0x81f3('0x0'));var net=require(_0x81f3('0x1'));var EventEmitter=require(_0x81f3('0x2'))[_0x81f3('0x3')];var AGIError=require(_0x81f3('0x4'));var AGIChannel=require(_0x81f3('0x5'));var AGIServer=function(_0x5100d4,_0x3f51d,_0x58b173){var _0x27656d=this,_0x5100d4=_0x5100d4||0x11dd,_0x3f51d=_0x3f51d||_0x81f3('0x6'),_0x59e5ae=null,_0x39633a=0x0;EventEmitter[_0x81f3('0x7')](_0x27656d);function _0x34b897(){if(!_0x5100d4){_0x27656d[_0x81f3('0x8')](_0x81f3('0x9'),new AGIError(_0x81f3('0xa')));return![];}_0x59e5ae=net[_0x81f3('0xb')]();_0x59e5ae[_0x81f3('0xc')](_0x5100d4,_0x3f51d);_0x59e5ae['on'](_0x81f3('0xd'),function(){_0x27656d[_0x81f3('0x8')]('listening');});_0x59e5ae['on'](_0x81f3('0xe'),function(_0x5f9efe){_0x59e5ae[_0x81f3('0xf')](function(_0x532ba,_0x255570){if(_0x532ba){_0x27656d['emit']('error',new AGIError(_0x81f3('0x10'),_0x532ba));}else if(_0x58b173&&_0x58b173<0x0){_0x27656d[_0x81f3('0x8')](_0x81f3('0x9'),new AGIError(_0x81f3('0x11')));_0x5f9efe[_0x81f3('0x12')]();}else if(_0x58b173&&_0x58b173>0x0&&_0x58b173<_0x255570){_0x39633a+=0x1;_0x27656d[_0x81f3('0x8')]('error',new AGIError(_0x81f3('0x13'),_0x39633a));_0x5f9efe[_0x81f3('0x12')]();}else{var _0x469b84=new AGIChannel(_0x5f9efe);_0x469b84['on']('ready',function(){_0x27656d[_0x81f3('0x8')](_0x81f3('0xe'),_0x469b84);});}});});_0x59e5ae['on'](_0x81f3('0x9'),function(_0x3a444c){_0x27656d[_0x81f3('0x8')](_0x81f3('0x9'),new AGIError(_0x81f3('0x10'),_0x3a444c[_0x81f3('0x14')]));});_0x59e5ae['on'](_0x81f3('0x15'),function(){_0x27656d[_0x81f3('0x8')](_0x81f3('0x15'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x81f3('0x16')](function(){_0x34b897();});};util[_0x81f3('0x17')](AGIServer,EventEmitter);module[_0x81f3('0x18')]=function(_0x280e16,_0xaacac2,_0x49181a){return new AGIServer(_0x280e16,_0xaacac2,_0x49181a);};