Built motion from commit (unavailable).|2.5.2
[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 _0x1050=['./agents.controller','./calls.controller','./queues.controller','./members.controller','./transfers.controller','./core.controller','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','port','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED'];(function(_0x163cd0,_0x461c03){var _0x166213=function(_0x450910){while(--_0x450910){_0x163cd0['push'](_0x163cd0['shift']());}};_0x166213(++_0x461c03);}(_0x1050,0x94));var _0x0105=function(_0x240856,_0x144e58){_0x240856=_0x240856-0x0;var _0x23c908=_0x1050[_0x240856];return _0x23c908;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require('./utils');var ami=new AsteriskManager(config[_0x0105('0x0')][_0x0105('0x1')],config[_0x0105('0x0')]['ip'],config[_0x0105('0x0')][_0x0105('0x2')],config[_0x0105('0x0')][_0x0105('0x3')],!![]);ami[_0x0105('0x4')]();if(config[_0x0105('0x5')]&&config['xdr'][_0x0105('0x6')]){utils['info'](_0x0105('0x7'));}else{var agents=require(_0x0105('0x8'));var calls=require(_0x0105('0x9'));var queues=require(_0x0105('0xa'));var recordings=require('./recordings.controller');var members=require(_0x0105('0xb'));var dials=require('./dials.controller');var transfers=require(_0x0105('0xc'));var core=require(_0x0105('0xd'));ami['on']('connect',core['connect']);ami['on']('shutdown',core[_0x0105('0xe')]);ami['on'](_0x0105('0xf'),core[_0x0105('0xf')]);ami['on'](_0x0105('0x10'),core[_0x0105('0x10')]);ami['on']('close',core[_0x0105('0x11')]);ami['on']('managerevent',core[_0x0105('0x12')]);ami['on'](_0x0105('0x13'),function(_0x1b155a){try{members[_0x0105('0x13')](_0x1b155a);}catch(_0x3ba5df){utils[_0x0105('0x10')](_0x3ba5df);}});ami['on'](_0x0105('0x14'),function(_0x3e2916){try{agents[_0x0105('0x14')](_0x3e2916);}catch(_0x181453){utils['error'](_0x181453);}});ami['on'](_0x0105('0x15'),function(_0x2cf98e){try{agents[_0x0105('0x15')](_0x2cf98e);}catch(_0x291454){utils[_0x0105('0x10')](_0x291454);}});ami['on'](_0x0105('0x16'),function(_0xd57610){try{agents[_0x0105('0x16')](_0xd57610);queues[_0x0105('0x16')](_0xd57610);}catch(_0x20faa1){utils[_0x0105('0x10')](_0x20faa1);}});ami['on'](_0x0105('0x17'),function(_0x5d42e1){try{agents[_0x0105('0x17')](_0x5d42e1);queues[_0x0105('0x17')](_0x5d42e1);members[_0x0105('0x17')](_0x5d42e1);}catch(_0x542dc2){utils[_0x0105('0x10')](_0x542dc2);}});ami['on'](_0x0105('0x18'),function(_0x3657c1){try{agents[_0x0105('0x18')](_0x3657c1);queues['queuecallerabandon'](_0x3657c1);}catch(_0x251bf9){utils[_0x0105('0x10')](_0x251bf9);}});ami['on'](_0x0105('0x19'),function(_0x17b673){try{queues[_0x0105('0x19')](_0x17b673);recordings[_0x0105('0x19')](_0x17b673);}catch(_0x5468fa){utils['error'](_0x5468fa);}});ami['on'](_0x0105('0x1a'),function(_0x195cf0){try{queues[_0x0105('0x1a')](_0x195cf0);}catch(_0x6e007c){utils['error'](_0x6e007c);}});ami['on'](_0x0105('0x1b'),function(_0xe62162){try{queues[_0x0105('0x1b')](_0xe62162);calls[_0x0105('0x1b')](_0xe62162);}catch(_0x3d9f5e){utils[_0x0105('0x10')](_0x3d9f5e);}});ami['on']('musiconholdstop',function(_0xe213d4){try{queues[_0x0105('0x1c')](_0xe213d4);calls['musiconholdstop'](_0xe213d4);}catch(_0x4e7df7){utils[_0x0105('0x10')](_0x4e7df7);}});ami['on'](_0x0105('0x1d'),function(_0x2c880b){try{calls['newstate'](_0x2c880b);recordings[_0x0105('0x1d')](_0x2c880b);}catch(_0x56b6da){utils[_0x0105('0x10')](_0x56b6da);}});ami['on'](_0x0105('0x1e'),function(_0x1c1c43){try{calls[_0x0105('0x1e')](_0x1c1c43);recordings[_0x0105('0x1e')](_0x1c1c43);dials[_0x0105('0x1e')](_0x1c1c43);agents[_0x0105('0x1e')](_0x1c1c43);queues[_0x0105('0x1e')](_0x1c1c43);}catch(_0x143752){utils[_0x0105('0x10')](_0x143752);}});ami['on'](_0x0105('0x1f'),function(_0x225b70){try{members[_0x0105('0x1f')](_0x225b70);}catch(_0x545f24){utils[_0x0105('0x10')](_0x545f24);}});ami['on']('blindtransfer',function(_0x524c38){try{queues[_0x0105('0x20')](_0x524c38);agents[_0x0105('0x20')](_0x524c38);transfers[_0x0105('0x20')](_0x524c38);}catch(_0x5042a9){utils[_0x0105('0x10')](_0x5042a9);}});ami['on'](_0x0105('0x21'),function(_0x20d8ee){try{queues[_0x0105('0x21')](_0x20d8ee);transfers['attendedtransfer'](_0x20d8ee);agents[_0x0105('0x21')](_0x20d8ee);calls[_0x0105('0x21')](_0x20d8ee);}catch(_0x21969a){utils[_0x0105('0x10')](_0x21969a);}});ami['on'](_0x0105('0x22'),function(_0x4c6f9d){try{queues[_0x0105('0x22')](_0x4c6f9d);recordings[_0x0105('0x22')](_0x4c6f9d);calls[_0x0105('0x22')](_0x4c6f9d);dials[_0x0105('0x22')](_0x4c6f9d);}catch(_0x491f95){utils[_0x0105('0x10')](_0x491f95);}});ami['on'](_0x0105('0x23'),function(_0x4497e3){try{calls[_0x0105('0x23')](_0x4497e3);recordings['newexten'](_0x4497e3);dials[_0x0105('0x23')](_0x4497e3);}catch(_0x33f84e){utils[_0x0105('0x10')](_0x33f84e);}});ami['on']('newchannel',function(_0x190eac){try{calls['newchannel'](_0x190eac);recordings[_0x0105('0x24')](_0x190eac);}catch(_0x27083b){utils[_0x0105('0x10')](_0x27083b);}});ami['on']('dialbegin',function(_0x341a31){try{dials[_0x0105('0x25')](_0x341a31);}catch(_0x28fe07){utils[_0x0105('0x10')](_0x28fe07);}});ami['on']('dialend',function(_0x4fe8e3){try{dials[_0x0105('0x26')](_0x4fe8e3);}catch(_0x5113b9){utils[_0x0105('0x10')](_0x5113b9);}});}