Built motion from commit (unavailable).|2.4.0
[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 _0x7227=['blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','../../config/environment','./utils','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr'];(function(_0x34b71e,_0x58f44d){var _0x2cb29b=function(_0x49282a){while(--_0x49282a){_0x34b71e['push'](_0x34b71e['shift']());}};_0x2cb29b(++_0x58f44d);}(_0x7227,0xe3));var _0x7722=function(_0x4b281d,_0x17ec63){_0x4b281d=_0x4b281d-0x0;var _0x103c12=_0x7227[_0x4b281d];return _0x103c12;};var AsteriskManager=require('asterisk-manager');var config=require(_0x7722('0x0'));var utils=require(_0x7722('0x1'));var ami=new AsteriskManager(config[_0x7722('0x2')][_0x7722('0x3')],config[_0x7722('0x2')]['ip'],config['asterisk'][_0x7722('0x4')],config[_0x7722('0x2')][_0x7722('0x5')],!![]);ami[_0x7722('0x6')]();if(config[_0x7722('0x7')]&&config[_0x7722('0x7')][_0x7722('0x8')]){utils[_0x7722('0x9')](_0x7722('0xa'));}else{var agents=require(_0x7722('0xb'));var calls=require(_0x7722('0xc'));var queues=require(_0x7722('0xd'));var recordings=require(_0x7722('0xe'));var members=require(_0x7722('0xf'));var dials=require(_0x7722('0x10'));var transfers=require(_0x7722('0x11'));var core=require(_0x7722('0x12'));ami['on'](_0x7722('0x13'),core['connect']);ami['on'](_0x7722('0x14'),core['shutdown']);ami['on'](_0x7722('0x15'),core[_0x7722('0x15')]);ami['on'](_0x7722('0x16'),core[_0x7722('0x16')]);ami['on']('close',core['close']);ami['on'](_0x7722('0x17'),core[_0x7722('0x17')]);ami['on'](_0x7722('0x18'),function(_0x56fbe6){try{members['devicestatechange'](_0x56fbe6);}catch(_0x5cdd25){utils[_0x7722('0x16')](_0x5cdd25);}});ami['on'](_0x7722('0x19'),function(_0x347bbf){try{agents[_0x7722('0x19')](_0x347bbf);}catch(_0x29a952){utils[_0x7722('0x16')](_0x29a952);}});ami['on']('agentringnoanswer',function(_0x5bd67e){try{agents[_0x7722('0x1a')](_0x5bd67e);}catch(_0x33c541){utils[_0x7722('0x16')](_0x33c541);}});ami['on'](_0x7722('0x1b'),function(_0xae5969){try{agents[_0x7722('0x1b')](_0xae5969);queues[_0x7722('0x1b')](_0xae5969);}catch(_0x290e6a){utils[_0x7722('0x16')](_0x290e6a);}});ami['on']('agentcomplete',function(_0x29e3a8){try{agents[_0x7722('0x1c')](_0x29e3a8);queues[_0x7722('0x1c')](_0x29e3a8);members[_0x7722('0x1c')](_0x29e3a8);}catch(_0x35edbd){utils['error'](_0x35edbd);}});ami['on'](_0x7722('0x1d'),function(_0xa88cd5){try{agents[_0x7722('0x1d')](_0xa88cd5);queues[_0x7722('0x1d')](_0xa88cd5);}catch(_0x8c30c7){utils['error'](_0x8c30c7);}});ami['on'](_0x7722('0x1e'),function(_0x4b8851){try{queues[_0x7722('0x1e')](_0x4b8851);recordings['queuecallerjoin'](_0x4b8851);}catch(_0x38d896){utils['error'](_0x38d896);}});ami['on']('queuecallerleave',function(_0x3816da){try{queues[_0x7722('0x1f')](_0x3816da);}catch(_0x247dc2){utils[_0x7722('0x16')](_0x247dc2);}});ami['on'](_0x7722('0x20'),function(_0x12979d){try{queues[_0x7722('0x20')](_0x12979d);calls[_0x7722('0x20')](_0x12979d);}catch(_0x24134f){utils[_0x7722('0x16')](_0x24134f);}});ami['on']('musiconholdstop',function(_0x701011){try{queues[_0x7722('0x21')](_0x701011);calls[_0x7722('0x21')](_0x701011);}catch(_0xa60b90){utils[_0x7722('0x16')](_0xa60b90);}});ami['on'](_0x7722('0x22'),function(_0x490e60){try{calls[_0x7722('0x22')](_0x490e60);recordings[_0x7722('0x22')](_0x490e60);}catch(_0x4f1499){utils[_0x7722('0x16')](_0x4f1499);}});ami['on']('hangup',function(_0x3721c5){try{calls[_0x7722('0x23')](_0x3721c5);recordings[_0x7722('0x23')](_0x3721c5);dials[_0x7722('0x23')](_0x3721c5);agents[_0x7722('0x23')](_0x3721c5);queues[_0x7722('0x23')](_0x3721c5);}catch(_0x5ec9f9){utils['error'](_0x5ec9f9);}});ami['on'](_0x7722('0x24'),function(_0x7ce947){try{members[_0x7722('0x24')](_0x7ce947);}catch(_0x58a737){utils[_0x7722('0x16')](_0x58a737);}});ami['on']('blindtransfer',function(_0x5af387){try{queues['blindtransfer'](_0x5af387);agents[_0x7722('0x25')](_0x5af387);transfers[_0x7722('0x25')](_0x5af387);}catch(_0x1e9048){utils[_0x7722('0x16')](_0x1e9048);}});ami['on'](_0x7722('0x26'),function(_0x163c83){try{queues['attendedtransfer'](_0x163c83);transfers[_0x7722('0x26')](_0x163c83);agents[_0x7722('0x26')](_0x163c83);calls['attendedtransfer'](_0x163c83);}catch(_0x5715d0){utils[_0x7722('0x16')](_0x5715d0);}});ami['on'](_0x7722('0x27'),function(_0x33b924){try{queues[_0x7722('0x27')](_0x33b924);recordings[_0x7722('0x27')](_0x33b924);calls['varset'](_0x33b924);dials[_0x7722('0x27')](_0x33b924);}catch(_0x3eeab4){utils[_0x7722('0x16')](_0x3eeab4);}});ami['on'](_0x7722('0x28'),function(_0x4e6aa9){try{calls[_0x7722('0x28')](_0x4e6aa9);recordings[_0x7722('0x28')](_0x4e6aa9);dials[_0x7722('0x28')](_0x4e6aa9);}catch(_0x746dcc){utils[_0x7722('0x16')](_0x746dcc);}});ami['on'](_0x7722('0x29'),function(_0x1f7710){try{calls[_0x7722('0x29')](_0x1f7710);recordings[_0x7722('0x29')](_0x1f7710);}catch(_0x381231){utils[_0x7722('0x16')](_0x381231);}});ami['on'](_0x7722('0x2a'),function(_0x19dab9){try{dials[_0x7722('0x2a')](_0x19dab9);}catch(_0x1c51e8){utils['error'](_0x1c51e8);}});ami['on']('dialend',function(_0x52410d){try{dials[_0x7722('0x2b')](_0x52410d);}catch(_0xea6bc){utils['error'](_0xea6bc);}});}