Built motion from commit (unavailable).|2.4.4
[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 _0xb2ca=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','EventEmitter','./error','./channel','127.0.0.1','emit','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2ca,0x1a8));var _0xab2c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb2ca[_0x138adb];return _0x1b27f2;};'use strict';var util=require(_0xab2c('0x0'));var net=require(_0xab2c('0x1'));var EventEmitter=require('events')[_0xab2c('0x2')];var AGIError=require(_0xab2c('0x3'));var AGIChannel=require(_0xab2c('0x4'));var AGIServer=function(_0x3adf9d,_0x396335,_0x9092a1){var _0x3c80f1=this,_0x3adf9d=_0x3adf9d||0x11dd,_0x396335=_0x396335||_0xab2c('0x5'),_0x3e9b88=null,_0x3efbc2=0x0;EventEmitter['call'](_0x3c80f1);function _0x33adc7(){if(!_0x3adf9d){_0x3c80f1[_0xab2c('0x6')](_0xab2c('0x7'),new AGIError(_0xab2c('0x8')));return![];}_0x3e9b88=net[_0xab2c('0x9')]();_0x3e9b88[_0xab2c('0xa')](_0x3adf9d,_0x396335);_0x3e9b88['on']('listening',function(){_0x3c80f1[_0xab2c('0x6')](_0xab2c('0xb'));});_0x3e9b88['on'](_0xab2c('0xc'),function(_0x4085f8){_0x3e9b88[_0xab2c('0xd')](function(_0x308592,_0x9383c5){if(_0x308592){_0x3c80f1[_0xab2c('0x6')](_0xab2c('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x308592));}else if(_0x9092a1&&_0x9092a1<0x0){_0x3c80f1['emit'](_0xab2c('0x7'),new AGIError(_0xab2c('0xe')));_0x4085f8[_0xab2c('0xf')]();}else if(_0x9092a1&&_0x9092a1>0x0&&_0x9092a1<_0x9383c5){_0x3efbc2+=0x1;_0x3c80f1[_0xab2c('0x6')](_0xab2c('0x7'),new AGIError(_0xab2c('0x10'),_0x3efbc2));_0x4085f8['destroy']();}else{var _0xcb6182=new AGIChannel(_0x4085f8);_0xcb6182['on'](_0xab2c('0x11'),function(){_0x3c80f1[_0xab2c('0x6')](_0xab2c('0xc'),_0xcb6182);});}});});_0x3e9b88['on']('error',function(_0x5cc6fb){_0x3c80f1['emit'](_0xab2c('0x7'),new AGIError(_0xab2c('0x12'),_0x5cc6fb[_0xab2c('0x13')]));});_0x3e9b88['on'](_0xab2c('0x14'),function(){_0x3c80f1[_0xab2c('0x6')](_0xab2c('0x14'),new AGIError(_0xab2c('0x15')));});}process[_0xab2c('0x16')](function(){_0x33adc7();});};util['inherits'](AGIServer,EventEmitter);module[_0xab2c('0x17')]=function(_0x222977,_0x4f4c7c,_0x99c052){return new AGIServer(_0x222977,_0x4f4c7c,_0x99c052);};