42a31c9f8a9baa1e64e0c24687762e0ff9ad707f
[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 _0xed95=['merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','message','result','catch','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','getUserById','GetContactByPhone','phone','getTrunkById','getSoundById','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport'];(function(_0xf5fbb7,_0xdb7f69){var _0x330d55=function(_0x45fd85){while(--_0x45fd85){_0xf5fbb7['push'](_0xf5fbb7['shift']());}};_0x330d55(++_0xdb7f69);}(_0xed95,0xb9));var _0x5ed9=function(_0xbbd4c7,_0x5dfb6b){_0xbbd4c7=_0xbbd4c7-0x0;var _0x15be19=_0xed95[_0xbbd4c7];return _0x15be19;};'use strict';var _=require(_0x5ed9('0x0'));var moment=require(_0x5ed9('0x1'));var jayson=require(_0x5ed9('0x2'));var client=jayson[_0x5ed9('0x3')][_0x5ed9('0x4')]({'port':0x2329});function request(_0x7b6960,_0x453f85){return new Promise(function(_0x3e2272,_0x2a28e9){return client[_0x5ed9('0x5')](_0x7b6960,_0x453f85)[_0x5ed9('0x6')](function(_0x15b734){if(_0x15b734['error']){return _0x2a28e9(_0x15b734['error'][_0x5ed9('0x7')]);}else{return _0x3e2272(_0x15b734[_0x5ed9('0x8')]);}})[_0x5ed9('0x9')](function(_0x34688d){return _0x2a28e9(_0x34688d);});});}exports[_0x5ed9('0xa')]=function(){return request(_0x5ed9('0xb'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x5ed9('0xc')]=function(_0xbe4c01){return request(_0x5ed9('0xd'),{'options':{'raw':![],'where':{'name':_0xbe4c01},'attributes':[_0x5ed9('0xe')]}});};exports['getMailAccountById']=function(_0x575782){return request(_0x5ed9('0xf'),{'options':{'raw':![],'where':{'id':_0x575782},'include':[{'model':_0x5ed9('0x10'),'as':_0x5ed9('0x11'),'include':[{'model':_0x5ed9('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0x5ed9('0x13'),_0x5ed9('0x14')],'smtp':!![]}});};exports[_0x5ed9('0x15')]=function(_0x5e463c){return request('ShowSquareProject',{'options':{'where':{'id':_0x5e463c},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x16')]=function(_0x5e952c){return request(_0x5ed9('0x17'),{'options':{'where':{'id':_0x5e952c},'attributes':[_0x5ed9('0x13')]}});};exports['getVariableById']=function(_0x57692b){return request(_0x5ed9('0x18'),{'options':{'where':{'id':_0x57692b},'attributes':[_0x5ed9('0x13')]}});};exports['getSquareOdbcById']=function(_0x3de09e){return request(_0x5ed9('0x19'),{'options':{'where':{'id':_0x3de09e},'attributes':['dsn']}});};exports[_0x5ed9('0x1a')]=function(_0xc6e591){return request('ShowUser',{'options':{'where':{'id':_0xc6e591},'attributes':['name']}});};exports['getContactByPhone']=function(_0x510ffe){return request(_0x5ed9('0x1b'),{'options':{'where':{'phone':_0x510ffe[_0x5ed9('0x1c')]},'attributes':['id']}});};exports[_0x5ed9('0x1d')]=function(_0x44b8ca){return request('ShowTrunk',{'options':{'where':{'id':_0x44b8ca},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x1e')]=function(_0x5cb2c1){return request('ShowSound',{'options':{'where':{'id':_0x5cb2c1},'attributes':['save_name']}});};exports[_0x5ed9('0x1f')]=function(_0x26a3c8){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x26a3c8},'include':[{'model':_0x5ed9('0x20'),'as':_0x5ed9('0x21')}]}});};exports[_0x5ed9('0x22')]=function(_0x71e104){return request('ShowSmsAccount',{'options':{'where':{'id':_0x71e104},'attributes':['id',_0x5ed9('0x13')]}});};exports[_0x5ed9('0x23')]=function(_0x38b462){return request(_0x5ed9('0x24'),{'body':_0x38b462});};exports[_0x5ed9('0x25')]=function(_0x14ae7b){return request('CreateSquareDetailsReport',{'body':_0x14ae7b});};exports['createSquareReport']=function(_0x36d7d5){return request(_0x5ed9('0x26'),{'body':_[_0x5ed9('0x27')](_0x36d7d5,{'project_name':_0x36d7d5['arg_1'],'prev_project_name':_0x36d7d5['arg_2']||'','is_subproject':_0x36d7d5[_0x5ed9('0x28')]?!![]:![],'leaveAt':moment()[_0x5ed9('0x29')](_0x5ed9('0x2a'))})});};exports['createSquareRecording']=function(_0x1bc137){return request(_0x5ed9('0x2b'),{'body':_0x1bc137});};exports[_0x5ed9('0x2c')]=function(_0x5a805b){return request(_0x5ed9('0x2d'),{'body':_0x5a805b});};exports[_0x5ed9('0x2e')]=function(_0x411729){return request(_0x5ed9('0x2f'),{'options':{'raw':![],'where':{'phone':_0x411729['phone'],'ListId':_0x411729['ListId']}}})[_0x5ed9('0x6')](function(_0x5d6599){if(_0x5d6599){return _0x5d6599;}return request(_0x5ed9('0x30'),{'body':_0x411729});});};exports[_0x5ed9('0x31')]=function(_0x1585e3){return request(_0x5ed9('0x32'),{'options':{'where':{'id':_0x1585e3},'attributes':[_0x5ed9('0x13')]}});};exports[_0x5ed9('0x33')]=function(_0xba5b97,_0x4a47f5){return request('LoginUser',{'body':{'interface':_0x4a47f5},'options':{'where':_0xba5b97}});};exports['agentPause']=function(_0x39771f,_0x36d050,_0x2cb3d2){return request('PauseUser',{'body':{'type':_0x36d050,'uniqueid':_0x2cb3d2},'options':{'where':_0x39771f}});};exports[_0x5ed9('0x34')]=function(_0x53575b){return request(_0x5ed9('0x35'),{'body':{},'options':{'where':_0x53575b}});};exports[_0x5ed9('0x36')]=function(_0x3061cd){return request(_0x5ed9('0x37'),{'body':{},'options':{'where':_0x3061cd}});};