Built motion from commit (unavailable).|2.4.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 _0x0034=['./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','./utils','asterisk','port','password','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller'];(function(_0x4a50f6,_0x520579){var _0x1621bf=function(_0x39235f){while(--_0x39235f){_0x4a50f6['push'](_0x4a50f6['shift']());}};_0x1621bf(++_0x520579);}(_0x0034,0x113));var _0x4003=function(_0x378380,_0x31dba0){_0x378380=_0x378380-0x0;var _0x2a4744=_0x0034[_0x378380];return _0x2a4744;};var AsteriskManager=require(_0x4003('0x0'));var config=require('../../config/environment');var utils=require(_0x4003('0x1'));var ami=new AsteriskManager(config[_0x4003('0x2')][_0x4003('0x3')],config['asterisk']['ip'],config[_0x4003('0x2')]['username'],config[_0x4003('0x2')][_0x4003('0x4')],!![]);ami['keepConnected']();if(config[_0x4003('0x5')]&&config[_0x4003('0x5')]['disabled']){utils[_0x4003('0x6')](_0x4003('0x7'));}else{var agents=require(_0x4003('0x8'));var calls=require(_0x4003('0x9'));var queues=require(_0x4003('0xa'));var recordings=require(_0x4003('0xb'));var members=require('./members.controller');var dials=require(_0x4003('0xc'));var transfers=require(_0x4003('0xd'));var core=require(_0x4003('0xe'));ami['on'](_0x4003('0xf'),core['connect']);ami['on']('shutdown',core[_0x4003('0x10')]);ami['on'](_0x4003('0x11'),core[_0x4003('0x11')]);ami['on'](_0x4003('0x12'),core[_0x4003('0x12')]);ami['on']('close',core[_0x4003('0x13')]);ami['on'](_0x4003('0x14'),core[_0x4003('0x14')]);ami['on'](_0x4003('0x15'),function(_0x169dee){try{members[_0x4003('0x15')](_0x169dee);}catch(_0x443521){utils[_0x4003('0x12')](_0x443521);}});ami['on'](_0x4003('0x16'),function(_0x2509af){try{agents['agentcalled'](_0x2509af);}catch(_0x3d8cad){utils[_0x4003('0x12')](_0x3d8cad);}});ami['on'](_0x4003('0x17'),function(_0x8c0a64){try{agents[_0x4003('0x17')](_0x8c0a64);}catch(_0x84f435){utils[_0x4003('0x12')](_0x84f435);}});ami['on'](_0x4003('0x18'),function(_0x470741){try{agents[_0x4003('0x18')](_0x470741);queues[_0x4003('0x18')](_0x470741);}catch(_0x37ae22){utils[_0x4003('0x12')](_0x37ae22);}});ami['on'](_0x4003('0x19'),function(_0x8fb969){try{agents[_0x4003('0x19')](_0x8fb969);queues[_0x4003('0x19')](_0x8fb969);members[_0x4003('0x19')](_0x8fb969);}catch(_0x54f2fd){utils['error'](_0x54f2fd);}});ami['on']('queuecallerabandon',function(_0xfc635a){try{agents['queuecallerabandon'](_0xfc635a);queues[_0x4003('0x1a')](_0xfc635a);}catch(_0x2210fb){utils[_0x4003('0x12')](_0x2210fb);}});ami['on'](_0x4003('0x1b'),function(_0x2e94a9){try{queues[_0x4003('0x1b')](_0x2e94a9);recordings[_0x4003('0x1b')](_0x2e94a9);}catch(_0x26d666){utils[_0x4003('0x12')](_0x26d666);}});ami['on'](_0x4003('0x1c'),function(_0x36e648){try{queues[_0x4003('0x1c')](_0x36e648);}catch(_0x2eadf6){utils['error'](_0x2eadf6);}});ami['on'](_0x4003('0x1d'),function(_0x2545c4){try{queues[_0x4003('0x1d')](_0x2545c4);calls[_0x4003('0x1d')](_0x2545c4);}catch(_0x4c2e54){utils[_0x4003('0x12')](_0x4c2e54);}});ami['on'](_0x4003('0x1e'),function(_0x56f7af){try{queues[_0x4003('0x1e')](_0x56f7af);calls[_0x4003('0x1e')](_0x56f7af);}catch(_0xdac097){utils[_0x4003('0x12')](_0xdac097);}});ami['on'](_0x4003('0x1f'),function(_0x2eeaaa){try{calls[_0x4003('0x1f')](_0x2eeaaa);recordings[_0x4003('0x1f')](_0x2eeaaa);}catch(_0x16a19a){utils[_0x4003('0x12')](_0x16a19a);}});ami['on'](_0x4003('0x20'),function(_0x2f1128){try{calls[_0x4003('0x20')](_0x2f1128);recordings[_0x4003('0x20')](_0x2f1128);dials[_0x4003('0x20')](_0x2f1128);agents[_0x4003('0x20')](_0x2f1128);queues['hangup'](_0x2f1128);}catch(_0x4ec094){utils['error'](_0x4ec094);}});ami['on'](_0x4003('0x21'),function(_0x3e3600){try{members[_0x4003('0x21')](_0x3e3600);}catch(_0x4e14dc){utils[_0x4003('0x12')](_0x4e14dc);}});ami['on'](_0x4003('0x22'),function(_0x537881){try{queues['blindtransfer'](_0x537881);agents[_0x4003('0x22')](_0x537881);transfers[_0x4003('0x22')](_0x537881);}catch(_0x14bcec){utils[_0x4003('0x12')](_0x14bcec);}});ami['on']('attendedtransfer',function(_0x3a1b8c){try{queues[_0x4003('0x23')](_0x3a1b8c);transfers[_0x4003('0x23')](_0x3a1b8c);agents[_0x4003('0x23')](_0x3a1b8c);calls[_0x4003('0x23')](_0x3a1b8c);}catch(_0x1f7726){utils[_0x4003('0x12')](_0x1f7726);}});ami['on'](_0x4003('0x24'),function(_0x15fafb){try{queues['varset'](_0x15fafb);recordings['varset'](_0x15fafb);calls[_0x4003('0x24')](_0x15fafb);dials[_0x4003('0x24')](_0x15fafb);}catch(_0x4934a4){utils[_0x4003('0x12')](_0x4934a4);}});ami['on'](_0x4003('0x25'),function(_0x23b11d){try{calls['newexten'](_0x23b11d);recordings[_0x4003('0x25')](_0x23b11d);dials[_0x4003('0x25')](_0x23b11d);}catch(_0x41072d){utils[_0x4003('0x12')](_0x41072d);}});ami['on'](_0x4003('0x26'),function(_0x36eda4){try{calls['newchannel'](_0x36eda4);recordings[_0x4003('0x26')](_0x36eda4);}catch(_0xfb89e){utils['error'](_0xfb89e);}});ami['on'](_0x4003('0x27'),function(_0x4ee922){try{dials[_0x4003('0x27')](_0x4ee922);}catch(_0x274f6d){utils['error'](_0x274f6d);}});ami['on'](_0x4003('0x28'),function(_0x3265cd){try{dials['dialend'](_0x3265cd);}catch(_0x3734c1){utils['error'](_0x3734c1);}});}