82d8015182ca26692e07f834830560057c112139
[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 _0x0cd6=['error','message','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','getIntervalById','Interval','getSmsAccountById','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','ShowPause','LoginUser','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','moment','client','http','then'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x0cd6,0x113));var _0x60cd=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x0cd6[_0x1488cd];return _0x63fa13;};'use strict';var _=require(_0x60cd('0x0'));var moment=require(_0x60cd('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x60cd('0x2')][_0x60cd('0x3')]({'port':0x2329});function request(_0x4d082a,_0x184850){return new Promise(function(_0x2f22ea,_0x519d95){return client['request'](_0x4d082a,_0x184850)[_0x60cd('0x4')](function(_0xefc62d){if(_0xefc62d[_0x60cd('0x5')]){return _0x519d95(_0xefc62d['error'][_0x60cd('0x6')]);}else{return _0x2f22ea(_0xefc62d['result']);}})[_0x60cd('0x7')](function(_0x2c973){return _0x519d95(_0x2c973);});});}exports[_0x60cd('0x8')]=function(){return request(_0x60cd('0x9'),{'options':{'raw':![],'attributes':['id',_0x60cd('0xa'),_0x60cd('0xb')]}});};exports[_0x60cd('0xc')]=function(_0x316912){return request(_0x60cd('0xd'),{'options':{'raw':![],'where':{'name':_0x316912},'attributes':['production']}});};exports[_0x60cd('0xe')]=function(_0x214e75){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x214e75},'include':[{'model':_0x60cd('0xf'),'as':'Smtp','include':[{'model':_0x60cd('0x10'),'as':_0x60cd('0x10')}]}],'attributes':['id','name',_0x60cd('0x11')],'smtp':!![]}});};exports[_0x60cd('0x12')]=function(_0x317275){return request('ShowSquareProject',{'options':{'where':{'id':_0x317275},'attributes':[_0x60cd('0xa')]}});};exports[_0x60cd('0x13')]=function(_0x53e158){return request(_0x60cd('0x14'),{'options':{'where':{'id':_0x53e158},'attributes':['name']}});};exports[_0x60cd('0x15')]=function(_0x41cc6b){return request('ShowVariable',{'options':{'where':{'id':_0x41cc6b},'attributes':['name']}});};exports[_0x60cd('0x16')]=function(_0x209dde){return request(_0x60cd('0x17'),{'options':{'where':{'id':_0x209dde},'attributes':['dsn']}});};exports[_0x60cd('0x18')]=function(_0x3b01bd){return request(_0x60cd('0x19'),{'options':{'where':{'id':_0x3b01bd},'attributes':[_0x60cd('0xa')]}});};exports[_0x60cd('0x1a')]=function(_0x3478d1){return request(_0x60cd('0x1b'),{'options':{'where':{'phone':_0x3478d1[_0x60cd('0x1c')]},'attributes':['id']}});};exports[_0x60cd('0x1d')]=function(_0x585ad8){return request(_0x60cd('0x1e'),{'options':{'where':{'id':_0x585ad8},'attributes':['name']}});};exports['getSoundById']=function(_0x298eeb){return request(_0x60cd('0x1f'),{'options':{'where':{'id':_0x298eeb},'attributes':['save_name']}});};exports[_0x60cd('0x20')]=function(_0x13e5cc){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x13e5cc},'include':[{'model':_0x60cd('0x21'),'as':'Intervals'}]}});};exports[_0x60cd('0x22')]=function(_0x41c290){return request('ShowSmsAccount',{'options':{'where':{'id':_0x41c290},'attributes':['id',_0x60cd('0xa')]}});};exports['createSmsMessage']=function(_0x5a9f30){return request(_0x60cd('0x23'),{'body':_0x5a9f30});};exports['createSquareDetailsReport']=function(_0x204ddb){return request(_0x60cd('0x24'),{'body':_0x204ddb});};exports['createSquareReport']=function(_0x4e3025){return request(_0x60cd('0x25'),{'body':_[_0x60cd('0x26')](_0x4e3025,{'project_name':_0x4e3025[_0x60cd('0x27')],'prev_project_name':_0x4e3025['arg_2']||'','is_subproject':_0x4e3025[_0x60cd('0x28')]?!![]:![],'leaveAt':moment()[_0x60cd('0x29')](_0x60cd('0x2a'))})});};exports[_0x60cd('0x2b')]=function(_0x547932){return request(_0x60cd('0x2c'),{'body':_0x547932});};exports[_0x60cd('0x2d')]=function(_0xd8051a){return request(_0x60cd('0x2e'),{'body':_0xd8051a});};exports[_0x60cd('0x2f')]=function(_0x4173f7){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4173f7[_0x60cd('0x1c')],'ListId':_0x4173f7[_0x60cd('0x30')]}}})[_0x60cd('0x4')](function(_0x55b207){if(_0x55b207){return _0x55b207;}return request(_0x60cd('0x31'),{'body':_0x4173f7});});};exports['getPauseById']=function(_0x379e85){return request(_0x60cd('0x32'),{'options':{'where':{'id':_0x379e85},'attributes':['name']}});};exports['agentLogin']=function(_0x24584a,_0x6afe6d){return request(_0x60cd('0x33'),{'body':{'interface':_0x6afe6d},'options':{'where':_0x24584a}});};exports['agentPause']=function(_0x60f77a,_0x2b4959,_0x320a3f){return request(_0x60cd('0x34'),{'body':{'type':_0x2b4959,'uniqueid':_0x320a3f},'options':{'where':_0x60f77a}});};exports[_0x60cd('0x35')]=function(_0x3aed82){return request(_0x60cd('0x36'),{'body':{},'options':{'where':_0x3aed82}});};exports['agentLogout']=function(_0xf4be4c){return request(_0x60cd('0x37'),{'body':{},'options':{'where':_0xf4be4c}});};