715e5709c314b14ef5278e1aa5d0318f122b5a5a
[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 _0x34aa=['ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowSquareProject','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','GetContactByPhone','phone','getTrunkById','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','agentUnpause','agentLogout','LogoutUser','lodash','jayson/promise','client','http','request','then','error','message','result','catch','GetSquareProjects','name','production','getSquareProject','getMailAccountById'];(function(_0x24f80a,_0x4b37a1){var _0x53a5c0=function(_0x2b2586){while(--_0x2b2586){_0x24f80a['push'](_0x24f80a['shift']());}};_0x53a5c0(++_0x4b37a1);}(_0x34aa,0x171));var _0xa34a=function(_0xee5d2a,_0x534134){_0xee5d2a=_0xee5d2a-0x0;var _0x346948=_0x34aa[_0xee5d2a];return _0x346948;};'use strict';var _=require(_0xa34a('0x0'));var moment=require('moment');var jayson=require(_0xa34a('0x1'));var client=jayson[_0xa34a('0x2')][_0xa34a('0x3')]({'port':0x2329});function request(_0x1fc924,_0x496e55){return new Promise(function(_0x1d7a4f,_0x30f3a2){return client[_0xa34a('0x4')](_0x1fc924,_0x496e55)[_0xa34a('0x5')](function(_0x49f29e){if(_0x49f29e[_0xa34a('0x6')]){return _0x30f3a2(_0x49f29e[_0xa34a('0x6')][_0xa34a('0x7')]);}else{return _0x1d7a4f(_0x49f29e[_0xa34a('0x8')]);}})[_0xa34a('0x9')](function(_0x467864){return _0x30f3a2(_0x467864);});});}exports['getSquareProjects']=function(){return request(_0xa34a('0xa'),{'options':{'raw':![],'attributes':['id',_0xa34a('0xb'),_0xa34a('0xc')]}});};exports[_0xa34a('0xd')]=function(_0x1e08cd){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x1e08cd},'attributes':[_0xa34a('0xc')]}});};exports[_0xa34a('0xe')]=function(_0x1c8e32){return request(_0xa34a('0xf'),{'options':{'raw':![],'where':{'id':_0x1c8e32},'include':[{'model':_0xa34a('0x10'),'as':_0xa34a('0x11'),'include':[{'model':_0xa34a('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0xa34a('0xb'),_0xa34a('0x13')],'smtp':!![]}});};exports[_0xa34a('0x14')]=function(_0x5ca87f){return request(_0xa34a('0x15'),{'options':{'where':{'id':_0x5ca87f},'attributes':[_0xa34a('0xb')]}});};exports['getVoiceQueueById']=function(_0x2f5ded){return request(_0xa34a('0x16'),{'options':{'where':{'id':_0x2f5ded},'attributes':['name']}});};exports[_0xa34a('0x17')]=function(_0x7ac9a2){return request(_0xa34a('0x18'),{'options':{'where':{'id':_0x7ac9a2},'attributes':[_0xa34a('0xb')]}});};exports[_0xa34a('0x19')]=function(_0x5da451){return request(_0xa34a('0x1a'),{'options':{'where':{'id':_0x5da451},'attributes':['dsn']}});};exports[_0xa34a('0x1b')]=function(_0x14837d){return request(_0xa34a('0x1c'),{'options':{'where':{'id':_0x14837d},'attributes':[_0xa34a('0xb')]}});};exports['getContactByPhone']=function(_0x27ad19){return request(_0xa34a('0x1d'),{'options':{'where':{'phone':_0x27ad19[_0xa34a('0x1e')]},'attributes':['id']}});};exports[_0xa34a('0x1f')]=function(_0xaa360e){return request('ShowTrunk',{'options':{'where':{'id':_0xaa360e},'attributes':[_0xa34a('0xb')]}});};exports[_0xa34a('0x20')]=function(_0x2ceab0){return request('ShowSound',{'options':{'where':{'id':_0x2ceab0},'attributes':[_0xa34a('0x21')]}});};exports[_0xa34a('0x22')]=function(_0x36749d){return request(_0xa34a('0x23'),{'options':{'raw':![],'where':{'id':_0x36749d},'include':[{'model':_0xa34a('0x24'),'as':_0xa34a('0x25')}]}});};exports['getSmsAccountById']=function(_0x28249a){return request(_0xa34a('0x26'),{'options':{'where':{'id':_0x28249a},'attributes':['id','name']}});};exports[_0xa34a('0x27')]=function(_0x377c4a){return request(_0xa34a('0x28'),{'body':_0x377c4a});};exports[_0xa34a('0x29')]=function(_0x25bc88){return request(_0xa34a('0x2a'),{'body':_0x25bc88});};exports[_0xa34a('0x2b')]=function(_0x54f08d){return request(_0xa34a('0x2c'),{'body':_[_0xa34a('0x2d')](_0x54f08d,{'project_name':_0x54f08d[_0xa34a('0x2e')],'prev_project_name':_0x54f08d[_0xa34a('0x2f')]||'','is_subproject':_0x54f08d['arg_2']?!![]:![],'leaveAt':moment()[_0xa34a('0x30')](_0xa34a('0x31'))})});};exports[_0xa34a('0x32')]=function(_0x2d1864){return request('CreateSquareRecording',{'body':_0x2d1864});};exports[_0xa34a('0x33')]=function(_0xd3de53){return request(_0xa34a('0x34'),{'body':_0xd3de53});};exports[_0xa34a('0x35')]=function(_0x48e428){return request(_0xa34a('0x36'),{'options':{'raw':![],'where':{'phone':_0x48e428[_0xa34a('0x1e')],'ListId':_0x48e428[_0xa34a('0x37')]}}})[_0xa34a('0x5')](function(_0x4e08e6){if(_0x4e08e6){return _0x4e08e6;}return request(_0xa34a('0x38'),{'body':_0x48e428});});};exports[_0xa34a('0x39')]=function(_0x4be616){return request(_0xa34a('0x3a'),{'options':{'where':{'id':_0x4be616},'attributes':[_0xa34a('0xb')]}});};exports['agentLogin']=function(_0x5f4a05,_0x1a4b8e){return request(_0xa34a('0x3b'),{'body':{'interface':_0x1a4b8e},'options':{'where':_0x5f4a05}});};exports[_0xa34a('0x3c')]=function(_0x21d57d,_0xa8890c,_0x248324){return request('PauseUser',{'body':{'type':_0xa8890c,'uniqueid':_0x248324},'options':{'where':_0x21d57d}});};exports[_0xa34a('0x3d')]=function(_0x33a633){return request('UnpauseUser',{'body':{},'options':{'where':_0x33a633}});};exports[_0xa34a('0x3e')]=function(_0x3349c){return request(_0xa34a('0x3f'),{'body':{},'options':{'where':_0x3349c}});};