5d9f1b84d45c34236172c6ca6e544773f1725283
[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 _0x6845=['ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x6845,0x1c2));var _0x5684=function(_0x1de0b2,_0x352f7f){_0x1de0b2=_0x1de0b2-0x0;var _0x3bcc72=_0x6845[_0x1de0b2];return _0x3bcc72;};'use strict';var BPromise=require(_0x5684('0x0'));var moment=require(_0x5684('0x1'));var _=require(_0x5684('0x2'));var util=require(_0x5684('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x5684('0x4')][_0x5684('0x5')]({'port':0x2329});function request(_0x5ca315,_0x607baf){return new BPromise(function(_0x3da080,_0x4545d3){return client[_0x5684('0x6')](_0x5ca315,_0x607baf)[_0x5684('0x7')](function(_0x57d271){if(_0x57d271['error']){return _0x4545d3(_0x57d271[_0x5684('0x8')][_0x5684('0x9')]);}else{return _0x3da080(_0x57d271[_0x5684('0xa')]);}})[_0x5684('0xb')](function(_0x7e7dd2){return _0x4545d3(_0x7e7dd2);});});}exports[_0x5684('0xc')]=function(_0x33ea2a){return request(_0x5684('0xd'),{'options':{'raw':![],'where':{'name':_0x33ea2a},'attributes':[_0x5684('0xe')]}});};exports[_0x5684('0xf')]=function(_0xd22df9){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0xd22df9},'include':[{'model':_0x5684('0x10'),'as':_0x5684('0x11')}],'attributes':['id',_0x5684('0x12'),_0x5684('0x13')]}});};exports['getSquareProjectById']=function(_0xa891f7){return request(_0x5684('0xd'),{'options':{'where':{'id':_0xa891f7},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0xf41f45){return request(_0x5684('0x14'),{'options':{'where':{'id':_0xf41f45},'attributes':[_0x5684('0x12')]}});};exports['getVariableById']=function(_0x20150a){return request(_0x5684('0x15'),{'options':{'where':{'id':_0x20150a},'attributes':[_0x5684('0x12')]}});};exports[_0x5684('0x16')]=function(_0x586561){return request(_0x5684('0x17'),{'options':{'where':{'id':_0x586561},'attributes':[_0x5684('0x18')]}});};exports[_0x5684('0x19')]=function(_0x23e029){return request(_0x5684('0x1a'),{'options':{'where':{'id':_0x23e029},'attributes':[_0x5684('0x12')]}});};exports[_0x5684('0x1b')]=function(_0x12787d){return request(_0x5684('0x1c'),{'options':{'where':{'id':_0x12787d},'attributes':['name']}});};exports[_0x5684('0x1d')]=function(_0x337640){return request('ShowSound',{'options':{'where':{'id':_0x337640},'attributes':[_0x5684('0x1e')]}});};exports[_0x5684('0x1f')]=function(_0x53b4e6){return request(_0x5684('0x20'),{'options':{'raw':![],'where':{'id':_0x53b4e6},'include':[{'model':_0x5684('0x21'),'as':'Intervals'}]}});};exports[_0x5684('0x22')]=function(_0x2baaf2){return request(_0x5684('0x23'),{'options':{'where':{'id':_0x2baaf2},'attributes':['id',_0x5684('0x12')]}});};exports[_0x5684('0x24')]=function(_0x4a7fc8){return request(_0x5684('0x25'),{'body':_0x4a7fc8});};exports[_0x5684('0x26')]=function(_0x4e9aec){return request(_0x5684('0x27'),{'body':_0x4e9aec});};exports['createSquareReport']=function(_0x5a26cd){return request(_0x5684('0x28'),{'body':_[_0x5684('0x29')](_0x5a26cd,{'project_name':_0x5a26cd[_0x5684('0x2a')],'prev_project_name':_0x5a26cd['arg_2']||'','is_subproject':_0x5a26cd[_0x5684('0x2b')]?!![]:![],'leaveAt':moment()[_0x5684('0x2c')](_0x5684('0x2d'))})});};exports[_0x5684('0x2e')]=function(_0x44838e){return request('CreateSquareRecording',{'body':_0x44838e});};exports[_0x5684('0x2f')]=function(_0x195e8e){return request(_0x5684('0x30'),{'body':_0x195e8e});};exports[_0x5684('0x31')]=function(_0x17b9f3){return request(_0x5684('0x32'),{'options':{'raw':![],'where':{'phone':_0x17b9f3['phone'],'ListId':_0x17b9f3[_0x5684('0x33')]}}})[_0x5684('0x7')](function(_0x2f0f8f){if(_0x2f0f8f){return _0x2f0f8f;}return request(_0x5684('0x34'),{'body':_0x17b9f3});});};exports[_0x5684('0x35')]=function(_0x3f8508){return request(_0x5684('0x36'),{'options':{'where':{'id':_0x3f8508},'attributes':[_0x5684('0x12')]}});};exports[_0x5684('0x37')]=function(_0x4c1175,_0x412f8f){return request(_0x5684('0x38'),{'body':{'interface':_0x412f8f},'options':{'where':_0x4c1175}});};exports[_0x5684('0x39')]=function(_0x44322b,_0x4f3492,_0x2c7289){return request(_0x5684('0x3a'),{'body':{'type':_0x4f3492,'uniqueid':_0x2c7289},'options':{'where':_0x44322b}});};exports[_0x5684('0x3b')]=function(_0x298fbe){return request(_0x5684('0x3c'),{'body':{},'options':{'where':_0x298fbe}});};exports[_0x5684('0x3d')]=function(_0x4561dc){return request(_0x5684('0x3e'),{'body':{},'options':{'where':_0x4561dc}});};