Built motion from commit 5293bb2a.|2.6.30
[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 _0x7a08=['getTrunkById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','http','request','then','error','message','catch','getSquareProjects','GetSquareProjects','name','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0x7a08,0x11e));var _0x87a0=function(_0x45dd0e,_0x28e603){_0x45dd0e=_0x45dd0e-0x0;var _0x50e5ca=_0x7a08[_0x45dd0e];return _0x50e5ca;};'use strict';var _=require(_0x87a0('0x0'));var moment=require(_0x87a0('0x1'));var jayson=require('jayson/promise');var client=jayson['client'][_0x87a0('0x2')]({'port':0x2329});function request(_0x5e6791,_0x1b3e4d){return new Promise(function(_0x8fd36d,_0x28c28f){return client[_0x87a0('0x3')](_0x5e6791,_0x1b3e4d)[_0x87a0('0x4')](function(_0x3c26e2){if(_0x3c26e2[_0x87a0('0x5')]){return _0x28c28f(_0x3c26e2[_0x87a0('0x5')][_0x87a0('0x6')]);}else{return _0x8fd36d(_0x3c26e2['result']);}})[_0x87a0('0x7')](function(_0x1bb04b){return _0x28c28f(_0x1bb04b);});});}exports[_0x87a0('0x8')]=function(){return request(_0x87a0('0x9'),{'options':{'raw':![],'attributes':['id',_0x87a0('0xa'),'production']}});};exports['getSquareProject']=function(_0x253737){return request(_0x87a0('0xb'),{'options':{'raw':![],'where':{'name':_0x253737},'attributes':[_0x87a0('0xc')]}});};exports[_0x87a0('0xd')]=function(_0x34ba3a){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x34ba3a},'include':[{'model':_0x87a0('0xe'),'as':_0x87a0('0xf'),'include':[{'model':_0x87a0('0x10'),'as':'CloudProvider'}]}],'attributes':['id',_0x87a0('0xa'),_0x87a0('0x11')],'smtp':!![]}});};exports[_0x87a0('0x12')]=function(_0x45a170){return request('ShowSquareProject',{'options':{'where':{'id':_0x45a170},'attributes':[_0x87a0('0xa')]}});};exports[_0x87a0('0x13')]=function(_0x290a29){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x290a29},'attributes':[_0x87a0('0xa')]}});};exports[_0x87a0('0x14')]=function(_0x3f69f3){return request(_0x87a0('0x15'),{'options':{'where':{'id':_0x3f69f3},'attributes':['name']}});};exports[_0x87a0('0x16')]=function(_0x57a941){return request(_0x87a0('0x17'),{'options':{'where':{'id':_0x57a941},'attributes':[_0x87a0('0x18')]}});};exports[_0x87a0('0x19')]=function(_0x26a72e){return request(_0x87a0('0x1a'),{'options':{'where':{'id':_0x26a72e},'attributes':['name']}});};exports[_0x87a0('0x1b')]=function(_0x57bf72){return request('GetContactByPhone',{'options':{'where':{'phone':_0x57bf72[_0x87a0('0x1c')]},'attributes':['id']}});};exports[_0x87a0('0x1d')]=function(_0x2a42ea){return request('ShowTrunk',{'options':{'where':{'id':_0x2a42ea},'attributes':[_0x87a0('0xa')]}});};exports['getSoundById']=function(_0x5a2c23){return request(_0x87a0('0x1e'),{'options':{'where':{'id':_0x5a2c23},'attributes':[_0x87a0('0x1f')]}});};exports[_0x87a0('0x20')]=function(_0x390bb2){return request(_0x87a0('0x21'),{'options':{'raw':![],'where':{'id':_0x390bb2},'include':[{'model':_0x87a0('0x22'),'as':'Intervals'}]}});};exports[_0x87a0('0x23')]=function(_0x1f59f7){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1f59f7},'attributes':['id',_0x87a0('0xa')]}});};exports[_0x87a0('0x24')]=function(_0x48dfe2){return request(_0x87a0('0x25'),{'body':_0x48dfe2});};exports['createSquareDetailsReport']=function(_0x152ae5){return request(_0x87a0('0x26'),{'body':_0x152ae5});};exports[_0x87a0('0x27')]=function(_0x39ef35){return request(_0x87a0('0x28'),{'body':_[_0x87a0('0x29')](_0x39ef35,{'project_name':_0x39ef35[_0x87a0('0x2a')],'prev_project_name':_0x39ef35[_0x87a0('0x2b')]||'','is_subproject':_0x39ef35[_0x87a0('0x2b')]?!![]:![],'leaveAt':moment()[_0x87a0('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x87a0('0x2d')]=function(_0x15f0f1){return request(_0x87a0('0x2e'),{'body':_0x15f0f1});};exports[_0x87a0('0x2f')]=function(_0x17ee9e){return request(_0x87a0('0x30'),{'body':_0x17ee9e});};exports[_0x87a0('0x31')]=function(_0x55dbf7){return request(_0x87a0('0x32'),{'options':{'raw':![],'where':{'phone':_0x55dbf7[_0x87a0('0x1c')],'ListId':_0x55dbf7[_0x87a0('0x33')]}}})[_0x87a0('0x4')](function(_0x482f6b){if(_0x482f6b){return _0x482f6b;}return request(_0x87a0('0x34'),{'body':_0x55dbf7});});};exports[_0x87a0('0x35')]=function(_0x4c511c){return request(_0x87a0('0x36'),{'options':{'where':{'id':_0x4c511c},'attributes':[_0x87a0('0xa')]}});};exports[_0x87a0('0x37')]=function(_0x50f24d,_0x2f02d1){return request(_0x87a0('0x38'),{'body':{'interface':_0x2f02d1},'options':{'where':_0x50f24d}});};exports[_0x87a0('0x39')]=function(_0x1b3769,_0x40c48a,_0x4b4cf9){return request(_0x87a0('0x3a'),{'body':{'type':_0x40c48a,'uniqueid':_0x4b4cf9},'options':{'where':_0x1b3769}});};exports[_0x87a0('0x3b')]=function(_0x33c335){return request(_0x87a0('0x3c'),{'body':{},'options':{'where':_0x33c335}});};exports[_0x87a0('0x3d')]=function(_0x6710bd){return request(_0x87a0('0x3e'),{'body':{},'options':{'where':_0x6710bd}});};