Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / services / xdr / index.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 _0xe7c8=['agentcomplete','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','../../config/environment','./utils','asterisk','password','keepConnected','xdr','info','./agents.controller','./calls.controller','./members.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect'];(function(_0x305a95,_0x3b5db7){var _0xdcebf3=function(_0x2296ea){while(--_0x2296ea){_0x305a95['push'](_0x305a95['shift']());}};_0xdcebf3(++_0x3b5db7);}(_0xe7c8,0x153));var _0x8e7c=function(_0x6e44a,_0x59d32e){_0x6e44a=_0x6e44a-0x0;var _0x60a105=_0xe7c8[_0x6e44a];return _0x60a105;};var AsteriskManager=require('asterisk-manager');var config=require(_0x8e7c('0x0'));var utils=require(_0x8e7c('0x1'));var ami=new AsteriskManager(config[_0x8e7c('0x2')]['port'],config[_0x8e7c('0x2')]['ip'],config['asterisk']['username'],config[_0x8e7c('0x2')][_0x8e7c('0x3')],!![]);ami[_0x8e7c('0x4')]();if(config[_0x8e7c('0x5')]&&config[_0x8e7c('0x5')]['disabled']){utils[_0x8e7c('0x6')]('XDR\x20DISABLED');}else{var agents=require(_0x8e7c('0x7'));var calls=require(_0x8e7c('0x8'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x8e7c('0x9'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0x8e7c('0xa'));ami['on'](_0x8e7c('0xb'),core['connect']);ami['on'](_0x8e7c('0xc'),core['shutdown']);ami['on'](_0x8e7c('0xd'),core['fullybooted']);ami['on']('error',core[_0x8e7c('0xe')]);ami['on'](_0x8e7c('0xf'),core['close']);ami['on']('managerevent',core[_0x8e7c('0x10')]);ami['on'](_0x8e7c('0x11'),function(_0x532414){try{members['devicestatechange'](_0x532414);}catch(_0xdc7083){utils[_0x8e7c('0xe')](_0xdc7083);}});ami['on'](_0x8e7c('0x12'),function(_0x27ae75){try{agents[_0x8e7c('0x12')](_0x27ae75);}catch(_0x5e6cc1){utils['error'](_0x5e6cc1);}});ami['on'](_0x8e7c('0x13'),function(_0x358e17){try{agents[_0x8e7c('0x13')](_0x358e17);}catch(_0x59b032){utils[_0x8e7c('0xe')](_0x59b032);}});ami['on'](_0x8e7c('0x14'),function(_0x4655e4){try{agents[_0x8e7c('0x14')](_0x4655e4);queues['agentconnect'](_0x4655e4);}catch(_0x4e03c8){utils[_0x8e7c('0xe')](_0x4e03c8);}});ami['on']('agentcomplete',function(_0xfde131){try{agents['agentcomplete'](_0xfde131);queues[_0x8e7c('0x15')](_0xfde131);members[_0x8e7c('0x15')](_0xfde131);}catch(_0x84f3df){utils[_0x8e7c('0xe')](_0x84f3df);}});ami['on']('queuecallerabandon',function(_0x3b7f0c){try{agents['queuecallerabandon'](_0x3b7f0c);queues['queuecallerabandon'](_0x3b7f0c);}catch(_0x2a4cd2){utils[_0x8e7c('0xe')](_0x2a4cd2);}});ami['on'](_0x8e7c('0x16'),function(_0x56d340){try{queues[_0x8e7c('0x16')](_0x56d340);recordings[_0x8e7c('0x16')](_0x56d340);}catch(_0x46a39e){utils[_0x8e7c('0xe')](_0x46a39e);}});ami['on'](_0x8e7c('0x17'),function(_0x59243e){try{queues[_0x8e7c('0x17')](_0x59243e);}catch(_0x151902){utils[_0x8e7c('0xe')](_0x151902);}});ami['on'](_0x8e7c('0x18'),function(_0x3800cf){try{queues[_0x8e7c('0x18')](_0x3800cf);calls[_0x8e7c('0x18')](_0x3800cf);}catch(_0x34c4f7){utils[_0x8e7c('0xe')](_0x34c4f7);}});ami['on'](_0x8e7c('0x19'),function(_0x376424){try{queues['musiconholdstop'](_0x376424);calls[_0x8e7c('0x19')](_0x376424);}catch(_0x46a81a){utils[_0x8e7c('0xe')](_0x46a81a);}});ami['on'](_0x8e7c('0x1a'),function(_0x263f2b){try{calls[_0x8e7c('0x1a')](_0x263f2b);recordings[_0x8e7c('0x1a')](_0x263f2b);}catch(_0x1dfce5){utils[_0x8e7c('0xe')](_0x1dfce5);}});ami['on'](_0x8e7c('0x1b'),function(_0x3f2c3e){try{calls[_0x8e7c('0x1b')](_0x3f2c3e);recordings[_0x8e7c('0x1b')](_0x3f2c3e);dials[_0x8e7c('0x1b')](_0x3f2c3e);agents[_0x8e7c('0x1b')](_0x3f2c3e);queues['hangup'](_0x3f2c3e);}catch(_0x221d5f){utils[_0x8e7c('0xe')](_0x221d5f);}});ami['on']('cdr',function(_0xda46f7){try{members[_0x8e7c('0x1c')](_0xda46f7);}catch(_0x59c535){utils[_0x8e7c('0xe')](_0x59c535);}});ami['on'](_0x8e7c('0x1d'),function(_0x67f5c3){try{queues[_0x8e7c('0x1d')](_0x67f5c3);agents[_0x8e7c('0x1d')](_0x67f5c3);transfers['blindtransfer'](_0x67f5c3);}catch(_0x3cd818){utils[_0x8e7c('0xe')](_0x3cd818);}});ami['on'](_0x8e7c('0x1e'),function(_0x39a5a3){try{queues[_0x8e7c('0x1e')](_0x39a5a3);transfers['attendedtransfer'](_0x39a5a3);agents[_0x8e7c('0x1e')](_0x39a5a3);calls[_0x8e7c('0x1e')](_0x39a5a3);}catch(_0x37b567){utils[_0x8e7c('0xe')](_0x37b567);}});ami['on'](_0x8e7c('0x1f'),function(_0x66ee25){try{queues[_0x8e7c('0x1f')](_0x66ee25);recordings[_0x8e7c('0x1f')](_0x66ee25);calls[_0x8e7c('0x1f')](_0x66ee25);dials[_0x8e7c('0x1f')](_0x66ee25);}catch(_0x571831){utils[_0x8e7c('0xe')](_0x571831);}});ami['on'](_0x8e7c('0x20'),function(_0x313fc6){try{calls[_0x8e7c('0x20')](_0x313fc6);recordings[_0x8e7c('0x20')](_0x313fc6);dials[_0x8e7c('0x20')](_0x313fc6);}catch(_0x4c6628){utils['error'](_0x4c6628);}});ami['on']('newchannel',function(_0x51f402){try{calls[_0x8e7c('0x21')](_0x51f402);recordings[_0x8e7c('0x21')](_0x51f402);}catch(_0x22935b){utils[_0x8e7c('0xe')](_0x22935b);}});ami['on'](_0x8e7c('0x22'),function(_0x208c2e){try{dials[_0x8e7c('0x22')](_0x208c2e);}catch(_0x3f61a8){utils[_0x8e7c('0xe')](_0x3f61a8);}});ami['on'](_0x8e7c('0x23'),function(_0x9ad246){try{dials[_0x8e7c('0x23')](_0x9ad246);}catch(_0xb45881){utils['error'](_0xb45881);}});}