a96d27557324e4d79dc1e7d4d4866c56d9ffefae
[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 _0xbff4=['asterisk','port','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','../../config/environment','./utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbff4,0x166));var _0x4bff=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0xbff4[_0x21090b];return _0x3c68d7;};var AsteriskManager=require('asterisk-manager');var config=require(_0x4bff('0x0'));var utils=require(_0x4bff('0x1'));var ami=new AsteriskManager(config[_0x4bff('0x2')][_0x4bff('0x3')],config[_0x4bff('0x2')]['ip'],config[_0x4bff('0x2')]['username'],config[_0x4bff('0x2')][_0x4bff('0x4')],!![]);ami[_0x4bff('0x5')]();if(config[_0x4bff('0x6')]&&config[_0x4bff('0x6')][_0x4bff('0x7')]){utils[_0x4bff('0x8')](_0x4bff('0x9'));}else{var agents=require(_0x4bff('0xa'));var calls=require(_0x4bff('0xb'));var queues=require(_0x4bff('0xc'));var recordings=require(_0x4bff('0xd'));var members=require(_0x4bff('0xe'));var dials=require('./dials.controller');var transfers=require(_0x4bff('0xf'));var core=require(_0x4bff('0x10'));ami['on'](_0x4bff('0x11'),core[_0x4bff('0x11')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x4bff('0x12'),core[_0x4bff('0x12')]);ami['on'](_0x4bff('0x13'),core[_0x4bff('0x13')]);ami['on'](_0x4bff('0x14'),core[_0x4bff('0x14')]);ami['on'](_0x4bff('0x15'),core[_0x4bff('0x15')]);ami['on'](_0x4bff('0x16'),function(_0x12d51f){try{members['devicestatechange'](_0x12d51f);}catch(_0x49093b){utils[_0x4bff('0x13')](_0x49093b);}});ami['on'](_0x4bff('0x17'),function(_0x4bdc40){try{agents[_0x4bff('0x17')](_0x4bdc40);}catch(_0x19e635){utils[_0x4bff('0x13')](_0x19e635);}});ami['on']('agentringnoanswer',function(_0x85ce44){try{agents['agentringnoanswer'](_0x85ce44);}catch(_0x38076c){utils[_0x4bff('0x13')](_0x38076c);}});ami['on'](_0x4bff('0x18'),function(_0x35fe58){try{agents[_0x4bff('0x18')](_0x35fe58);queues[_0x4bff('0x18')](_0x35fe58);}catch(_0x367fda){utils['error'](_0x367fda);}});ami['on']('agentcomplete',function(_0x5edbe1){try{agents['agentcomplete'](_0x5edbe1);queues[_0x4bff('0x19')](_0x5edbe1);members[_0x4bff('0x19')](_0x5edbe1);}catch(_0x126cc6){utils[_0x4bff('0x13')](_0x126cc6);}});ami['on'](_0x4bff('0x1a'),function(_0x49ea3f){try{agents[_0x4bff('0x1a')](_0x49ea3f);queues[_0x4bff('0x1a')](_0x49ea3f);}catch(_0x1e83ef){utils[_0x4bff('0x13')](_0x1e83ef);}});ami['on']('queuecallerjoin',function(_0x5483a2){try{queues['queuecallerjoin'](_0x5483a2);recordings[_0x4bff('0x1b')](_0x5483a2);}catch(_0x17a275){utils[_0x4bff('0x13')](_0x17a275);}});ami['on'](_0x4bff('0x1c'),function(_0x5efbac){try{queues[_0x4bff('0x1c')](_0x5efbac);}catch(_0x17cb69){utils[_0x4bff('0x13')](_0x17cb69);}});ami['on'](_0x4bff('0x1d'),function(_0x3b3399){try{queues[_0x4bff('0x1d')](_0x3b3399);calls['musiconholdstart'](_0x3b3399);}catch(_0x17e744){utils['error'](_0x17e744);}});ami['on'](_0x4bff('0x1e'),function(_0x3c105e){try{queues['musiconholdstop'](_0x3c105e);calls[_0x4bff('0x1e')](_0x3c105e);}catch(_0x4679bf){utils[_0x4bff('0x13')](_0x4679bf);}});ami['on'](_0x4bff('0x1f'),function(_0x1ce6ea){try{calls[_0x4bff('0x1f')](_0x1ce6ea);recordings[_0x4bff('0x1f')](_0x1ce6ea);}catch(_0x4b7ec3){utils[_0x4bff('0x13')](_0x4b7ec3);}});ami['on'](_0x4bff('0x20'),function(_0x3b66ec){try{calls[_0x4bff('0x20')](_0x3b66ec);recordings[_0x4bff('0x20')](_0x3b66ec);dials[_0x4bff('0x20')](_0x3b66ec);agents[_0x4bff('0x20')](_0x3b66ec);queues['hangup'](_0x3b66ec);}catch(_0x305332){utils[_0x4bff('0x13')](_0x305332);}});ami['on']('cdr',function(_0x1aba66){try{members[_0x4bff('0x21')](_0x1aba66);}catch(_0x197033){utils['error'](_0x197033);}});ami['on'](_0x4bff('0x22'),function(_0x13082a){try{queues[_0x4bff('0x22')](_0x13082a);agents['blindtransfer'](_0x13082a);transfers[_0x4bff('0x22')](_0x13082a);}catch(_0x237ce5){utils['error'](_0x237ce5);}});ami['on'](_0x4bff('0x23'),function(_0x15a397){try{queues[_0x4bff('0x23')](_0x15a397);transfers[_0x4bff('0x23')](_0x15a397);agents[_0x4bff('0x23')](_0x15a397);calls[_0x4bff('0x23')](_0x15a397);}catch(_0x56a96c){utils['error'](_0x56a96c);}});ami['on'](_0x4bff('0x24'),function(_0xa797f){try{queues[_0x4bff('0x24')](_0xa797f);recordings['varset'](_0xa797f);calls['varset'](_0xa797f);dials['varset'](_0xa797f);}catch(_0x4a30ef){utils[_0x4bff('0x13')](_0x4a30ef);}});ami['on'](_0x4bff('0x25'),function(_0x1a02f1){try{calls[_0x4bff('0x25')](_0x1a02f1);recordings[_0x4bff('0x25')](_0x1a02f1);dials[_0x4bff('0x25')](_0x1a02f1);}catch(_0x1b5985){utils['error'](_0x1b5985);}});ami['on'](_0x4bff('0x26'),function(_0x443505){try{calls[_0x4bff('0x26')](_0x443505);recordings[_0x4bff('0x26')](_0x443505);}catch(_0x5a78a1){utils[_0x4bff('0x13')](_0x5a78a1);}});ami['on'](_0x4bff('0x27'),function(_0x4656dc){try{dials[_0x4bff('0x27')](_0x4656dc);}catch(_0x5bbcf6){utils[_0x4bff('0x13')](_0x5bbcf6);}});ami['on']('dialend',function(_0x4546be){try{dials['dialend'](_0x4546be);}catch(_0x8928cc){utils[_0x4bff('0x13')](_0x8928cc);}});}