95bf386e05d3df5f870e17e591bb0130a03204a5
[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 _0xba6c=['name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','arg_1','arg_2','format','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise','client','http','error','message','result','catch','getSquareProjects','GetSquareProjects'];(function(_0x210304,_0x2d19c6){var _0x470ac7=function(_0x5b5aea){while(--_0x5b5aea){_0x210304['push'](_0x210304['shift']());}};_0x470ac7(++_0x2d19c6);}(_0xba6c,0x113));var _0xcba6=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0xba6c[_0x22dac7];return _0x3e6cfa;};'use strict';var _=require(_0xcba6('0x0'));var moment=require('moment');var jayson=require(_0xcba6('0x1'));var client=jayson[_0xcba6('0x2')][_0xcba6('0x3')]({'port':0x2329});function request(_0x20b811,_0x3030b5){return new Promise(function(_0x3e9fb9,_0x2b34a3){return client['request'](_0x20b811,_0x3030b5)['then'](function(_0x26cab8){if(_0x26cab8[_0xcba6('0x4')]){return _0x2b34a3(_0x26cab8[_0xcba6('0x4')][_0xcba6('0x5')]);}else{return _0x3e9fb9(_0x26cab8[_0xcba6('0x6')]);}})[_0xcba6('0x7')](function(_0x308366){return _0x2b34a3(_0x308366);});});}exports[_0xcba6('0x8')]=function(){return request(_0xcba6('0x9'),{'options':{'raw':![],'attributes':['id',_0xcba6('0xa'),_0xcba6('0xb')]}});};exports['getSquareProject']=function(_0x314b40){return request(_0xcba6('0xc'),{'options':{'raw':![],'where':{'name':_0x314b40},'attributes':[_0xcba6('0xb')]}});};exports[_0xcba6('0xd')]=function(_0x4873ed){return request(_0xcba6('0xe'),{'options':{'raw':![],'where':{'id':_0x4873ed},'include':[{'model':'MailServerOut','as':_0xcba6('0xf'),'include':[{'model':_0xcba6('0x10'),'as':'CloudProvider'}]}],'attributes':['id',_0xcba6('0xa'),'email'],'smtp':!![]}});};exports[_0xcba6('0x11')]=function(_0x554fc7){return request('ShowSquareProject',{'options':{'where':{'id':_0x554fc7},'attributes':['name']}});};exports[_0xcba6('0x12')]=function(_0x247c46){return request(_0xcba6('0x13'),{'options':{'where':{'id':_0x247c46},'attributes':[_0xcba6('0xa')]}});};exports[_0xcba6('0x14')]=function(_0x480327){return request(_0xcba6('0x15'),{'options':{'where':{'id':_0x480327},'attributes':['name']}});};exports[_0xcba6('0x16')]=function(_0x46aae5){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x46aae5},'attributes':[_0xcba6('0x17')]}});};exports[_0xcba6('0x18')]=function(_0x1885e8){return request(_0xcba6('0x19'),{'options':{'where':{'id':_0x1885e8},'attributes':[_0xcba6('0xa')]}});};exports[_0xcba6('0x1a')]=function(_0x1441ef){return request(_0xcba6('0x1b'),{'options':{'where':{'phone':_0x1441ef[_0xcba6('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x5391b8){return request('ShowTrunk',{'options':{'where':{'id':_0x5391b8},'attributes':['name']}});};exports['getSoundById']=function(_0x555e78){return request(_0xcba6('0x1d'),{'options':{'where':{'id':_0x555e78},'attributes':['save_name']}});};exports[_0xcba6('0x1e')]=function(_0x232442){return request(_0xcba6('0x1f'),{'options':{'raw':![],'where':{'id':_0x232442},'include':[{'model':'Interval','as':_0xcba6('0x20')}]}});};exports[_0xcba6('0x21')]=function(_0x44cd8e){return request('ShowSmsAccount',{'options':{'where':{'id':_0x44cd8e},'attributes':['id',_0xcba6('0xa')]}});};exports[_0xcba6('0x22')]=function(_0xdc549e){return request('CreateSmsMessage',{'body':_0xdc549e});};exports[_0xcba6('0x23')]=function(_0x73d718){return request(_0xcba6('0x24'),{'body':_0x73d718});};exports[_0xcba6('0x25')]=function(_0x5f1a69){return request('CreateSquareReport',{'body':_['merge'](_0x5f1a69,{'project_name':_0x5f1a69[_0xcba6('0x26')],'prev_project_name':_0x5f1a69['arg_2']||'','is_subproject':_0x5f1a69[_0xcba6('0x27')]?!![]:![],'leaveAt':moment()[_0xcba6('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x1d85e7){return request('CreateSquareRecording',{'body':_0x1d85e7});};exports[_0xcba6('0x29')]=function(_0x2b7889){return request(_0xcba6('0x2a'),{'body':_0x2b7889});};exports[_0xcba6('0x2b')]=function(_0x4604d8){return request(_0xcba6('0x2c'),{'options':{'raw':![],'where':{'phone':_0x4604d8['phone'],'ListId':_0x4604d8[_0xcba6('0x2d')]}}})[_0xcba6('0x2e')](function(_0x4f4725){if(_0x4f4725){return _0x4f4725;}return request('CreateCmContact',{'body':_0x4604d8});});};exports[_0xcba6('0x2f')]=function(_0x32d7a9){return request(_0xcba6('0x30'),{'options':{'where':{'id':_0x32d7a9},'attributes':[_0xcba6('0xa')]}});};exports[_0xcba6('0x31')]=function(_0x2040f9,_0x43c701){return request(_0xcba6('0x32'),{'body':{'interface':_0x43c701},'options':{'where':_0x2040f9}});};exports[_0xcba6('0x33')]=function(_0x1a60b3,_0x586cb1,_0x53120e){return request(_0xcba6('0x34'),{'body':{'type':_0x586cb1,'uniqueid':_0x53120e},'options':{'where':_0x1a60b3}});};exports[_0xcba6('0x35')]=function(_0x5e5d37){return request(_0xcba6('0x36'),{'body':{},'options':{'where':_0x5e5d37}});};exports[_0xcba6('0x37')]=function(_0x3a82f8){return request(_0xcba6('0x38'),{'body':{},'options':{'where':_0x3a82f8}});};