Built motion from commit (unavailable).|2.3.9
[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 _0xc5eb=['dialbegin','dialend','asterisk-manager','../../config/environment','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','./utils','asterisk','port','password','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel'];(function(_0x2caa09,_0x559829){var _0x500ce2=function(_0x59e380){while(--_0x59e380){_0x2caa09['push'](_0x2caa09['shift']());}};_0x500ce2(++_0x559829);}(_0xc5eb,0x188));var _0xbc5e=function(_0x136319,_0x521686){_0x136319=_0x136319-0x0;var _0xcc2483=_0xc5eb[_0x136319];return _0xcc2483;};var AsteriskManager=require(_0xbc5e('0x0'));var config=require(_0xbc5e('0x1'));var agents=require('./agents.controller');var calls=require(_0xbc5e('0x2'));var queues=require(_0xbc5e('0x3'));var recordings=require(_0xbc5e('0x4'));var members=require(_0xbc5e('0x5'));var dials=require(_0xbc5e('0x6'));var transfers=require(_0xbc5e('0x7'));var core=require(_0xbc5e('0x8'));var utils=require(_0xbc5e('0x9'));var ami=new AsteriskManager(config[_0xbc5e('0xa')][_0xbc5e('0xb')],config[_0xbc5e('0xa')]['ip'],config[_0xbc5e('0xa')]['username'],config[_0xbc5e('0xa')][_0xbc5e('0xc')],!![]);ami['keepConnected']();ami['on'](_0xbc5e('0xd'),core[_0xbc5e('0xd')]);ami['on']('shutdown',core[_0xbc5e('0xe')]);ami['on'](_0xbc5e('0xf'),core[_0xbc5e('0xf')]);ami['on'](_0xbc5e('0x10'),core['error']);ami['on'](_0xbc5e('0x11'),core[_0xbc5e('0x11')]);ami['on']('managerevent',core[_0xbc5e('0x12')]);ami['on'](_0xbc5e('0x13'),function(_0x20ad0a){try{members[_0xbc5e('0x13')](_0x20ad0a);}catch(_0xa703c2){utils[_0xbc5e('0x10')](_0xa703c2);}});ami['on'](_0xbc5e('0x14'),function(_0x968535){try{agents['agentcalled'](_0x968535);}catch(_0x3f6888){utils[_0xbc5e('0x10')](_0x3f6888);}});ami['on'](_0xbc5e('0x15'),function(_0xf229ec){try{agents[_0xbc5e('0x15')](_0xf229ec);}catch(_0x1832e9){utils['error'](_0x1832e9);}});ami['on'](_0xbc5e('0x16'),function(_0x4eb10b){try{agents[_0xbc5e('0x16')](_0x4eb10b);queues[_0xbc5e('0x16')](_0x4eb10b);}catch(_0xc12144){utils['error'](_0xc12144);}});ami['on']('agentcomplete',function(_0x452ab6){try{agents[_0xbc5e('0x17')](_0x452ab6);queues[_0xbc5e('0x17')](_0x452ab6);members['agentcomplete'](_0x452ab6);}catch(_0x49427a){utils[_0xbc5e('0x10')](_0x49427a);}});ami['on']('queuecallerabandon',function(_0x364841){try{agents['queuecallerabandon'](_0x364841);queues[_0xbc5e('0x18')](_0x364841);}catch(_0x1ce810){utils[_0xbc5e('0x10')](_0x1ce810);}});ami['on'](_0xbc5e('0x19'),function(_0x1a29ac){try{queues[_0xbc5e('0x19')](_0x1a29ac);}catch(_0x3219d7){utils['error'](_0x3219d7);}});ami['on'](_0xbc5e('0x1a'),function(_0x1866e9){try{queues['queuecallerleave'](_0x1866e9);}catch(_0x143fd4){utils[_0xbc5e('0x10')](_0x143fd4);}});ami['on'](_0xbc5e('0x1b'),function(_0x2a6641){try{queues[_0xbc5e('0x1b')](_0x2a6641);calls[_0xbc5e('0x1b')](_0x2a6641);}catch(_0x5d1a1b){utils[_0xbc5e('0x10')](_0x5d1a1b);}});ami['on'](_0xbc5e('0x1c'),function(_0x1384ef){try{queues['musiconholdstop'](_0x1384ef);calls[_0xbc5e('0x1c')](_0x1384ef);}catch(_0x3d5990){utils['error'](_0x3d5990);}});ami['on'](_0xbc5e('0x1d'),function(_0x1603b7){try{calls['newstate'](_0x1603b7);recordings[_0xbc5e('0x1d')](_0x1603b7);dials[_0xbc5e('0x1d')](_0x1603b7);}catch(_0x6b9d95){utils['error'](_0x6b9d95);}});ami['on'](_0xbc5e('0x1e'),function(_0x5c7e16){try{calls[_0xbc5e('0x1e')](_0x5c7e16);recordings[_0xbc5e('0x1e')](_0x5c7e16);dials[_0xbc5e('0x1e')](_0x5c7e16);agents[_0xbc5e('0x1e')](_0x5c7e16);queues[_0xbc5e('0x1e')](_0x5c7e16);}catch(_0x274c90){utils[_0xbc5e('0x10')](_0x274c90);}});ami['on'](_0xbc5e('0x1f'),function(_0x39e3c0){try{members[_0xbc5e('0x1f')](_0x39e3c0);}catch(_0x17c1c2){utils[_0xbc5e('0x10')](_0x17c1c2);}});ami['on'](_0xbc5e('0x20'),function(_0x45627d){try{queues[_0xbc5e('0x20')](_0x45627d);agents['blindtransfer'](_0x45627d);transfers[_0xbc5e('0x20')](_0x45627d);}catch(_0x170058){utils[_0xbc5e('0x10')](_0x170058);}});ami['on'](_0xbc5e('0x21'),function(_0x96eb9e){try{queues[_0xbc5e('0x21')](_0x96eb9e);transfers[_0xbc5e('0x21')](_0x96eb9e);agents['attendedtransfer'](_0x96eb9e);calls['attendedtransfer'](_0x96eb9e);}catch(_0x31e138){utils[_0xbc5e('0x10')](_0x31e138);}});ami['on']('varset',function(_0x4f698a){try{queues[_0xbc5e('0x22')](_0x4f698a);recordings[_0xbc5e('0x22')](_0x4f698a);calls[_0xbc5e('0x22')](_0x4f698a);dials[_0xbc5e('0x22')](_0x4f698a);}catch(_0x52af8e){utils[_0xbc5e('0x10')](_0x52af8e);}});ami['on']('newexten',function(_0x4e4872){try{calls[_0xbc5e('0x23')](_0x4e4872);recordings[_0xbc5e('0x23')](_0x4e4872);dials['newexten'](_0x4e4872);}catch(_0x4ff057){utils[_0xbc5e('0x10')](_0x4ff057);}});ami['on'](_0xbc5e('0x24'),function(_0xc7d428){try{calls[_0xbc5e('0x24')](_0xc7d428);recordings[_0xbc5e('0x24')](_0xc7d428);}catch(_0x5c4c77){utils[_0xbc5e('0x10')](_0x5c4c77);}});ami['on'](_0xbc5e('0x25'),function(_0x16a7d2){try{dials[_0xbc5e('0x25')](_0x16a7d2);}catch(_0x34230a){utils[_0xbc5e('0x10')](_0x34230a);}});ami['on'](_0xbc5e('0x26'),function(_0x2b19d9){try{dials[_0xbc5e('0x26')](_0x2b19d9);}catch(_0xb0e619){utils[_0xbc5e('0x10')](_0xb0e619);}});