aaae0c3592cd623b0d4d21bc382478a10309f5b9
[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 _0xb2b3=['error','message','result','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','ShowVariable','dsn','getUserById','GetContactByPhone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','lodash','moment','jayson/promise','client','http','request','then'];(function(_0x243ed1,_0x44b528){var _0x4a978c=function(_0x2a6a79){while(--_0x2a6a79){_0x243ed1['push'](_0x243ed1['shift']());}};_0x4a978c(++_0x44b528);}(_0xb2b3,0x71));var _0x3b2b=function(_0x124201,_0x58f60d){_0x124201=_0x124201-0x0;var _0x54ebd7=_0xb2b3[_0x124201];return _0x54ebd7;};'use strict';var _=require(_0x3b2b('0x0'));var moment=require(_0x3b2b('0x1'));var jayson=require(_0x3b2b('0x2'));var client=jayson[_0x3b2b('0x3')][_0x3b2b('0x4')]({'port':0x2329});function request(_0x3de73b,_0x2059f0){return new Promise(function(_0x4dad94,_0x3eff63){return client[_0x3b2b('0x5')](_0x3de73b,_0x2059f0)[_0x3b2b('0x6')](function(_0x45e179){if(_0x45e179[_0x3b2b('0x7')]){return _0x3eff63(_0x45e179[_0x3b2b('0x7')][_0x3b2b('0x8')]);}else{return _0x4dad94(_0x45e179[_0x3b2b('0x9')]);}})[_0x3b2b('0xa')](function(_0x3ec416){return _0x3eff63(_0x3ec416);});});}exports[_0x3b2b('0xb')]=function(){return request(_0x3b2b('0xc'),{'options':{'raw':![],'attributes':['id','name',_0x3b2b('0xd')]}});};exports[_0x3b2b('0xe')]=function(_0xd2f168){return request(_0x3b2b('0xf'),{'options':{'raw':![],'where':{'name':_0xd2f168},'attributes':[_0x3b2b('0xd')]}});};exports[_0x3b2b('0x10')]=function(_0x4e66fe){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4e66fe},'include':[{'model':_0x3b2b('0x11'),'as':_0x3b2b('0x12'),'include':[{'model':_0x3b2b('0x13'),'as':_0x3b2b('0x13')}]}],'attributes':['id','name',_0x3b2b('0x14')],'smtp':!![]}});};exports[_0x3b2b('0x15')]=function(_0x23b81b){return request(_0x3b2b('0xf'),{'options':{'where':{'id':_0x23b81b},'attributes':[_0x3b2b('0x16')]}});};exports[_0x3b2b('0x17')]=function(_0x52b63f){return request(_0x3b2b('0x18'),{'options':{'where':{'id':_0x52b63f},'attributes':[_0x3b2b('0x16')]}});};exports['getVariableById']=function(_0x3224ec){return request(_0x3b2b('0x19'),{'options':{'where':{'id':_0x3224ec},'attributes':[_0x3b2b('0x16')]}});};exports['getSquareOdbcById']=function(_0x2ab175){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2ab175},'attributes':[_0x3b2b('0x1a')]}});};exports[_0x3b2b('0x1b')]=function(_0x57a2b4){return request('ShowUser',{'options':{'where':{'id':_0x57a2b4},'attributes':[_0x3b2b('0x16')]}});};exports['getContactByPhone']=function(_0x157155){return request(_0x3b2b('0x1c'),{'options':{'where':{'phone':_0x157155['phone']},'attributes':['id']}});};exports[_0x3b2b('0x1d')]=function(_0x4ff5e3){return request(_0x3b2b('0x1e'),{'options':{'where':{'id':_0x4ff5e3},'attributes':[_0x3b2b('0x16')]}});};exports['getSoundById']=function(_0x59abc3){return request(_0x3b2b('0x1f'),{'options':{'where':{'id':_0x59abc3},'attributes':[_0x3b2b('0x20')]}});};exports[_0x3b2b('0x21')]=function(_0x46db63){return request(_0x3b2b('0x22'),{'options':{'raw':![],'where':{'id':_0x46db63},'include':[{'model':_0x3b2b('0x23'),'as':_0x3b2b('0x24')}]}});};exports[_0x3b2b('0x25')]=function(_0x1273e7){return request(_0x3b2b('0x26'),{'options':{'where':{'id':_0x1273e7},'attributes':['id',_0x3b2b('0x16')]}});};exports['createSmsMessage']=function(_0x20c1bc){return request(_0x3b2b('0x27'),{'body':_0x20c1bc});};exports[_0x3b2b('0x28')]=function(_0x50e95c){return request(_0x3b2b('0x29'),{'body':_0x50e95c});};exports['createSquareReport']=function(_0x19f358){return request('CreateSquareReport',{'body':_[_0x3b2b('0x2a')](_0x19f358,{'project_name':_0x19f358['arg_1'],'prev_project_name':_0x19f358['arg_2']||'','is_subproject':_0x19f358[_0x3b2b('0x2b')]?!![]:![],'leaveAt':moment()[_0x3b2b('0x2c')](_0x3b2b('0x2d'))})});};exports[_0x3b2b('0x2e')]=function(_0x73967){return request(_0x3b2b('0x2f'),{'body':_0x73967});};exports[_0x3b2b('0x30')]=function(_0x185830){return request(_0x3b2b('0x31'),{'body':_0x185830});};exports['createCmContact']=function(_0x4ed952){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4ed952['phone'],'ListId':_0x4ed952[_0x3b2b('0x32')]}}})[_0x3b2b('0x6')](function(_0x3a1ff8){if(_0x3a1ff8){return _0x3a1ff8;}return request(_0x3b2b('0x33'),{'body':_0x4ed952});});};exports[_0x3b2b('0x34')]=function(_0x34fc22){return request(_0x3b2b('0x35'),{'options':{'where':{'id':_0x34fc22},'attributes':['name']}});};exports[_0x3b2b('0x36')]=function(_0x54f942,_0x48a62a){return request(_0x3b2b('0x37'),{'body':{'interface':_0x48a62a},'options':{'where':_0x54f942}});};exports[_0x3b2b('0x38')]=function(_0x281f1a,_0x107285,_0x5040e2){return request('PauseUser',{'body':{'type':_0x107285,'uniqueid':_0x5040e2},'options':{'where':_0x281f1a}});};exports[_0x3b2b('0x39')]=function(_0x3a7b4b){return request(_0x3b2b('0x3a'),{'body':{},'options':{'where':_0x3a7b4b}});};exports[_0x3b2b('0x3b')]=function(_0x2b745e){return request('LogoutUser',{'body':{},'options':{'where':_0x2b745e}});};