Built motion from commit (unavailable).|2.4.16
[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 _0x4559=['dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','PauseUser','agentUnpause','agentLogout','LogoutUser','moment','util','jayson/promise','client','request','then','error','result','catch','getSquareProject','ShowSquareProject','getMailAccountById','Smtp','name','email','getVoiceQueueById','getVariableById'];(function(_0xf17091,_0x264f81){var _0x287ed8=function(_0x1cd160){while(--_0x1cd160){_0xf17091['push'](_0xf17091['shift']());}};_0x287ed8(++_0x264f81);}(_0x4559,0x18f));var _0x9455=function(_0x1e9483,_0x1a4949){_0x1e9483=_0x1e9483-0x0;var _0x4b7e09=_0x4559[_0x1e9483];return _0x4b7e09;};'use strict';var BPromise=require('bluebird');var moment=require(_0x9455('0x0'));var _=require('lodash');var util=require(_0x9455('0x1'));var jayson=require(_0x9455('0x2'));var client=jayson[_0x9455('0x3')]['http']({'port':0x2329});function request(_0x16aa0d,_0x273a17){return new BPromise(function(_0x591b2d,_0x488045){return client[_0x9455('0x4')](_0x16aa0d,_0x273a17)[_0x9455('0x5')](function(_0x374563){if(_0x374563[_0x9455('0x6')]){return _0x488045(_0x374563['error']['message']);}else{return _0x591b2d(_0x374563[_0x9455('0x7')]);}})[_0x9455('0x8')](function(_0x38aa31){return _0x488045(_0x38aa31);});});}exports[_0x9455('0x9')]=function(_0x1b3235){return request(_0x9455('0xa'),{'options':{'raw':![],'where':{'name':_0x1b3235},'attributes':['production']}});};exports[_0x9455('0xb')]=function(_0x3e60d1){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3e60d1},'include':[{'model':'MailServerOut','as':_0x9455('0xc')}],'attributes':['id',_0x9455('0xd'),_0x9455('0xe')]}});};exports['getSquareProjectById']=function(_0x148e15){return request(_0x9455('0xa'),{'options':{'where':{'id':_0x148e15},'attributes':['name']}});};exports[_0x9455('0xf')]=function(_0xee7d87){return request('ShowVoiceQueue',{'options':{'where':{'id':_0xee7d87},'attributes':[_0x9455('0xd')]}});};exports[_0x9455('0x10')]=function(_0x615f7){return request('ShowVariable',{'options':{'where':{'id':_0x615f7},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x3a15b9){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3a15b9},'attributes':[_0x9455('0x11')]}});};exports[_0x9455('0x12')]=function(_0x3bf457){return request(_0x9455('0x13'),{'options':{'where':{'id':_0x3bf457},'attributes':[_0x9455('0xd')]}});};exports[_0x9455('0x14')]=function(_0x21077d){return request(_0x9455('0x15'),{'options':{'where':{'id':_0x21077d},'attributes':[_0x9455('0xd')]}});};exports[_0x9455('0x16')]=function(_0x1d9045){return request(_0x9455('0x17'),{'options':{'where':{'id':_0x1d9045},'attributes':[_0x9455('0x18')]}});};exports[_0x9455('0x19')]=function(_0x192429){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x192429},'include':[{'model':_0x9455('0x1a'),'as':_0x9455('0x1b')}]}});};exports['getSmsAccountById']=function(_0x14cbf1){return request('ShowSmsAccount',{'options':{'where':{'id':_0x14cbf1},'attributes':['id',_0x9455('0xd')]}});};exports[_0x9455('0x1c')]=function(_0xb0a5e4){return request(_0x9455('0x1d'),{'body':_0xb0a5e4});};exports['createSquareDetailsReport']=function(_0x3fe2a2){return request(_0x9455('0x1e'),{'body':_0x3fe2a2});};exports[_0x9455('0x1f')]=function(_0x2849a4){return request(_0x9455('0x20'),{'body':_[_0x9455('0x21')](_0x2849a4,{'project_name':_0x2849a4[_0x9455('0x22')],'prev_project_name':_0x2849a4[_0x9455('0x23')]||'','is_subproject':_0x2849a4['arg_2']?!![]:![],'leaveAt':moment()[_0x9455('0x24')](_0x9455('0x25'))})});};exports[_0x9455('0x26')]=function(_0x44f4d9){return request('CreateSquareRecording',{'body':_0x44f4d9});};exports[_0x9455('0x27')]=function(_0x816c1d){return request(_0x9455('0x28'),{'body':_0x816c1d});};exports[_0x9455('0x29')]=function(_0x32a147){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x32a147[_0x9455('0x2a')],'ListId':_0x32a147[_0x9455('0x2b')]}}})['then'](function(_0x55d1db){if(_0x55d1db){return _0x55d1db;}return request(_0x9455('0x2c'),{'body':_0x32a147});});};exports[_0x9455('0x2d')]=function(_0xcebcbf){return request(_0x9455('0x2e'),{'options':{'where':{'id':_0xcebcbf},'attributes':[_0x9455('0xd')]}});};exports['agentLogin']=function(_0x1df50a,_0x3d4814){return request(_0x9455('0x2f'),{'body':{'interface':_0x3d4814},'options':{'where':_0x1df50a}});};exports['agentPause']=function(_0x35d7f9,_0x1a6924,_0x2b75b1){return request(_0x9455('0x30'),{'body':{'type':_0x1a6924,'uniqueid':_0x2b75b1},'options':{'where':_0x35d7f9}});};exports[_0x9455('0x31')]=function(_0x5e5761){return request('UnpauseUser',{'body':{},'options':{'where':_0x5e5761}});};exports[_0x9455('0x32')]=function(_0x3fe7c3){return request(_0x9455('0x33'),{'body':{},'options':{'where':_0x3fe7c3}});};