Built motion from commit d6d69adf.|2.6.33
[motion2.git] / server / services / agi / rpc / 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 _0x207c=['getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','Smtp','CloudProvider','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','agentLogout','LogoutUser','moment','jayson/promise','client','http','request','error','message','result'];(function(_0x329235,_0x3724ef){var _0x43d9a0=function(_0xd804e5){while(--_0xd804e5){_0x329235['push'](_0x329235['shift']());}};_0x43d9a0(++_0x3724ef);}(_0x207c,0x1e8));var _0xc207=function(_0x2d05fa,_0x372364){_0x2d05fa=_0x2d05fa-0x0;var _0x10ae61=_0x207c[_0x2d05fa];return _0x10ae61;};'use strict';var _=require('lodash');var moment=require(_0xc207('0x0'));var jayson=require(_0xc207('0x1'));var client=jayson[_0xc207('0x2')][_0xc207('0x3')]({'port':0x2329});function request(_0x2b40be,_0x12f1f2){return new Promise(function(_0x1dd107,_0x4b9daa){return client[_0xc207('0x4')](_0x2b40be,_0x12f1f2)['then'](function(_0x5a727b){if(_0x5a727b['error']){return _0x4b9daa(_0x5a727b[_0xc207('0x5')][_0xc207('0x6')]);}else{return _0x1dd107(_0x5a727b[_0xc207('0x7')]);}})['catch'](function(_0x25cb97){return _0x4b9daa(_0x25cb97);});});}exports[_0xc207('0x8')]=function(){return request(_0xc207('0x9'),{'options':{'raw':![],'attributes':['id','name',_0xc207('0xa')]}});};exports[_0xc207('0xb')]=function(_0x216e14){return request(_0xc207('0xc'),{'options':{'raw':![],'where':{'name':_0x216e14},'attributes':[_0xc207('0xa')]}});};exports[_0xc207('0xd')]=function(_0x487d95){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x487d95},'include':[{'model':'MailServerOut','as':_0xc207('0xe'),'include':[{'model':'CloudProvider','as':_0xc207('0xf')}]}],'attributes':['id',_0xc207('0x10'),'email'],'smtp':!![]}});};exports[_0xc207('0x11')]=function(_0xb86b06){return request(_0xc207('0xc'),{'options':{'where':{'id':_0xb86b06},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x12')]=function(_0x51e967){return request(_0xc207('0x13'),{'options':{'where':{'id':_0x51e967},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x14')]=function(_0x4031ad){return request('ShowVariable',{'options':{'where':{'id':_0x4031ad},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x1cebfa){return request(_0xc207('0x15'),{'options':{'where':{'id':_0x1cebfa},'attributes':[_0xc207('0x16')]}});};exports[_0xc207('0x17')]=function(_0x4b8f44){return request(_0xc207('0x18'),{'options':{'where':{'id':_0x4b8f44},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x19')]=function(_0x5f288e){return request(_0xc207('0x1a'),{'options':{'where':{'phone':_0x5f288e['phone']},'attributes':['id']}});};exports[_0xc207('0x1b')]=function(_0x33ddb1){return request(_0xc207('0x1c'),{'options':{'where':{'id':_0x33ddb1},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x1d')]=function(_0x2caec5){return request(_0xc207('0x1e'),{'options':{'where':{'id':_0x2caec5},'attributes':[_0xc207('0x1f')]}});};exports[_0xc207('0x20')]=function(_0x2bd2eb){return request(_0xc207('0x21'),{'options':{'raw':![],'where':{'id':_0x2bd2eb},'include':[{'model':_0xc207('0x22'),'as':_0xc207('0x23')}]}});};exports['getSmsAccountById']=function(_0x163b36){return request('ShowSmsAccount',{'options':{'where':{'id':_0x163b36},'attributes':['id',_0xc207('0x10')]}});};exports[_0xc207('0x24')]=function(_0x1eabe8){return request(_0xc207('0x25'),{'body':_0x1eabe8});};exports[_0xc207('0x26')]=function(_0xd209ac){return request(_0xc207('0x27'),{'body':_0xd209ac});};exports[_0xc207('0x28')]=function(_0xa52138){return request(_0xc207('0x29'),{'body':_[_0xc207('0x2a')](_0xa52138,{'project_name':_0xa52138[_0xc207('0x2b')],'prev_project_name':_0xa52138[_0xc207('0x2c')]||'','is_subproject':_0xa52138[_0xc207('0x2c')]?!![]:![],'leaveAt':moment()[_0xc207('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xc207('0x2e')]=function(_0x5e0bd1){return request('CreateSquareRecording',{'body':_0x5e0bd1});};exports[_0xc207('0x2f')]=function(_0x3a05f3){return request(_0xc207('0x30'),{'body':_0x3a05f3});};exports[_0xc207('0x31')]=function(_0x6a653d){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x6a653d[_0xc207('0x32')],'ListId':_0x6a653d[_0xc207('0x33')]}}})[_0xc207('0x34')](function(_0x1bec3f){if(_0x1bec3f){return _0x1bec3f;}return request(_0xc207('0x35'),{'body':_0x6a653d});});};exports[_0xc207('0x36')]=function(_0x2e6a3e){return request(_0xc207('0x37'),{'options':{'where':{'id':_0x2e6a3e},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x38')]=function(_0x2043cf,_0xaa1b54){return request(_0xc207('0x39'),{'body':{'interface':_0xaa1b54},'options':{'where':_0x2043cf}});};exports['agentPause']=function(_0x1cc799,_0xc6f834,_0x1c4027){return request(_0xc207('0x3a'),{'body':{'type':_0xc6f834,'uniqueid':_0x1c4027},'options':{'where':_0x1cc799}});};exports[_0xc207('0x3b')]=function(_0x2ce133){return request('UnpauseUser',{'body':{},'options':{'where':_0x2ce133}});};exports[_0xc207('0x3c')]=function(_0x3b3d23){return request(_0xc207('0x3d'),{'body':{},'options':{'where':_0x3b3d23}});};